pytest-bdd/tests/scripts/test_main.py

19 lines
460 B
Python

"""Main command."""
import os
import sys
from pytest_bdd.scripts import main
PATH = os.path.dirname(__file__)
def test_main(monkeypatch, capsys):
"""Test if main command shows help when called without the subcommand."""
monkeypatch.setattr(sys, "argv", ["pytest-bdd"])
monkeypatch.setattr(sys, "exit", lambda x: x)
main()
out, err = capsys.readouterr()
assert "usage: pytest-bdd [-h]" in err
assert "pytest-bdd: error:" in err