Skip to content

Commit

Permalink
add --co option to collect-only (pytest-dev#6116)
Browse files Browse the repository at this point in the history
add --co option to collect-only
  • Loading branch information
nicoddemus authored Nov 7, 2019
2 parents 3b24340 + 4946cc8 commit 6ad9571
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog/6116.improvement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add ``--co`` as a synonym to ``--collect-only``.
1 change: 1 addition & 0 deletions src/_pytest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def pytest_addoption(parser):
group.addoption(
"--collectonly",
"--collect-only",
"--co",
action="store_true",
help="only collect tests, don't execute them.",
),
Expand Down
4 changes: 2 additions & 2 deletions testing/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def pytest_collect_file(path, parent):
)
testdir.mkdir("sub")
testdir.makepyfile("def test_x(): pass")
result = testdir.runpytest("--collect-only")
result = testdir.runpytest("--co")
result.stdout.fnmatch_lines(["*MyModule*", "*test_x*"])

def test_pytest_collect_file_from_sister_dir(self, testdir):
Expand Down Expand Up @@ -433,7 +433,7 @@ def pytest_collect_file(path, parent):
p = testdir.makepyfile("def test_x(): pass")
p.copy(sub1.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*"])


Expand Down

0 comments on commit 6ad9571

Please sign in to comment.