0
按照pytest文檔,我應該能夠使用「和」表達這樣的:pytest -k標誌與聲明和
pytest -k stringexpr # only run tests with names that match the
# "string expression", e.g. "MyClass and not method"
# will select TestMyClass.test_something
# but not TestMyClass.test_method_simple
我想什麼了是這樣的表達:
pytest -v test_file.py -k 「TestTest and not test_bad」
而且我得到的錯誤是:
ERROR: file not found: and
其他變化我都試過,在同一失敗告終:
pytest -v -k 「TestTest and not test_bad」
pytest -v -k 「TestTest and not test_bad」 test_file.py
最後我pytest的版本是:3.0.3
是'test_file.py'與您正在運行py.test命令的位置相同的位置嗎?基本上這個錯誤意味着找不到文件'test_file.py'。嘗試給出完整的路徑。 – Sanju