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

Function test_main

tests/scripts/test_main.py:12–19  ·  view source on GitHub ↗

Test if main command shows help when called without the subcommand.

(monkeypatch, capsys)

Source from the content-addressed store, hash-verified

10
11
12def test_main(monkeypatch, capsys):
13 """Test if main command shows help when called without the subcommand."""
14 monkeypatch.setattr(sys, "argv", ["pytest-bdd"])
15 monkeypatch.setattr(sys, "exit", lambda x: x)
16 main()
17 out, err = capsys.readouterr()
18 assert "usage: pytest-bdd [-h]" in err
19 assert "pytest-bdd: error:" in err
20
21
22def test_step_definitions_found_using_main(pytester):

Callers

nothing calls this directly

Calls 1

mainFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…