add ability to specify an individual Python test

This commit is contained in:
Damien Elmes 2020-12-16 10:40:29 +10:00
parent 4adf6c62e0
commit 1b98e7e48f

View file

@ -7,4 +7,9 @@ os.environ["SHIFT_CLOCK_HACK"] = "1"
if __name__ == "__main__": if __name__ == "__main__":
folder = os.path.join(os.path.dirname(__file__), "..", "tests") folder = os.path.join(os.path.dirname(__file__), "..", "tests")
sys.exit(pytest.main(["--verbose", "-s", folder])) args = ["--verbose", "-s", folder]
# allow specifying an individual test, eg
# bazel test //pylib:pytest --test_env=PYTEST=test_bury
if pytest_extra := os.environ.get("PYTEST", ""):
args.extend(["-k", pytest_extra])
sys.exit(pytest.main(args))