add --co option to collect-only (#6116)
add --co option to collect-only
This commit is contained in:
commit
6ad95716da
|
@ -0,0 +1 @@
|
||||||
|
Add ``--co`` as a synonym to ``--collect-only``.
|
|
@ -109,6 +109,7 @@ def pytest_addoption(parser):
|
||||||
group.addoption(
|
group.addoption(
|
||||||
"--collectonly",
|
"--collectonly",
|
||||||
"--collect-only",
|
"--collect-only",
|
||||||
|
"--co",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="only collect tests, don't execute them.",
|
help="only collect tests, don't execute them.",
|
||||||
),
|
),
|
||||||
|
|
|
@ -402,7 +402,7 @@ class TestCustomConftests:
|
||||||
)
|
)
|
||||||
testdir.mkdir("sub")
|
testdir.mkdir("sub")
|
||||||
testdir.makepyfile("def test_x(): pass")
|
testdir.makepyfile("def test_x(): pass")
|
||||||
result = testdir.runpytest("--collect-only")
|
result = testdir.runpytest("--co")
|
||||||
result.stdout.fnmatch_lines(["*MyModule*", "*test_x*"])
|
result.stdout.fnmatch_lines(["*MyModule*", "*test_x*"])
|
||||||
|
|
||||||
def test_pytest_collect_file_from_sister_dir(self, testdir):
|
def test_pytest_collect_file_from_sister_dir(self, testdir):
|
||||||
|
@ -433,7 +433,7 @@ class TestCustomConftests:
|
||||||
p = testdir.makepyfile("def test_x(): pass")
|
p = testdir.makepyfile("def test_x(): pass")
|
||||||
p.copy(sub1.join(p.basename))
|
p.copy(sub1.join(p.basename))
|
||||||
p.copy(sub2.join(p.basename))
|
p.copy(sub2.join(p.basename))
|
||||||
result = testdir.runpytest("--collect-only")
|
result = testdir.runpytest("--co")
|
||||||
result.stdout.fnmatch_lines(["*MyModule1*", "*MyModule2*", "*test_x*"])
|
result.stdout.fnmatch_lines(["*MyModule1*", "*MyModule2*", "*test_x*"])
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue