MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_custom_prog

Method test_custom_prog

testing/test_parseopt.py:25–29  ·  view source on GitHub ↗

Custom prog can be set for `argparse.ArgumentParser`.

(self, parser: parseopt.Parser)

Source from the content-addressed store, hash-verified

23 pytest.raises(UsageError, lambda: parser.parse(["-h"]))
24
25 def test_custom_prog(self, parser: parseopt.Parser) -> None:
26 """Custom prog can be set for `argparse.ArgumentParser`."""
27 assert parser._getparser().prog == os.path.basename(sys.argv[0])
28 parser.prog = "custom-prog"
29 assert parser._getparser().prog == "custom-prog"
30
31 def test_argument(self) -> None:
32 with pytest.raises(parseopt.ArgumentError):

Callers

nothing calls this directly

Calls 1

_getparserMethod · 0.80

Tested by

no test coverage detected