Fix crash if `--cache-show` and `--help` are passed at the same time
Closes #10592
This commit is contained in:
parent
096b942ec4
commit
4d4ed42c34
1
AUTHORS
1
AUTHORS
|
@ -378,6 +378,7 @@ Xixi Zhao
|
|||
Xuan Luong
|
||||
Xuecong Liao
|
||||
Yoav Caspi
|
||||
Yuliang Shao
|
||||
Yusuke Kadowaki
|
||||
Yuval Shimon
|
||||
Zac Hatfield-Dodds
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Fixed crash if `--cache-show` and `--help` are passed at the same time.
|
|
@ -32,7 +32,6 @@ from _pytest.python import Module
|
|||
from _pytest.python import Package
|
||||
from _pytest.reports import TestReport
|
||||
|
||||
|
||||
README_CONTENT = """\
|
||||
# pytest cache directory #
|
||||
|
||||
|
@ -492,7 +491,7 @@ def pytest_addoption(parser: Parser) -> None:
|
|||
|
||||
|
||||
def pytest_cmdline_main(config: Config) -> Optional[Union[int, ExitCode]]:
|
||||
if config.option.cacheshow:
|
||||
if config.option.cacheshow and not config.option.help:
|
||||
from _pytest.main import wrap_session
|
||||
|
||||
return wrap_session(config, cacheshow)
|
||||
|
|
|
@ -1249,3 +1249,8 @@ def test_cachedir_tag(pytester: Pytester) -> None:
|
|||
cache.set("foo", "bar")
|
||||
cachedir_tag_path = cache._cachedir.joinpath("CACHEDIR.TAG")
|
||||
assert cachedir_tag_path.read_bytes() == CACHEDIR_TAG_CONTENT
|
||||
|
||||
|
||||
def test_clioption_with_cacheshow_and_help(pytester: Pytester) -> None:
|
||||
result = pytester.runpytest("--cache-show", "--help")
|
||||
assert result.ret == 0
|
||||
|
|
Loading…
Reference in New Issue