Commits

Ronny Pfannschmidt committed 2d9a02c

patch changes

Comments (0)

Files changed (2)

collectonly-session-no-items

 # HG changeset patch
-# Parent 816d24a54c2fe5d7c96842340df48a0b009b2d76
+# Parent f8f976918f25fdfdfa38e239801b1ac60e88f9c6
 dont fail in collectonly if session doesnt yet have the items attribute, fixes #115
 
+diff --git a/CHANGELOG b/CHANGELOG
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -16,6 +16,8 @@ Changes between 2.2.1 and 2.2.2.dev
+   this helps xdist serialization/deserialization of extended/customized reports
+ - add support for more quiet collectonly, which only prints the number of tests per file,
+   instead of the nodeids
++- fix issue115: make --collectonly robust against session failing
++  before it has items
+ 
+ Changes between 2.2.0 and 2.2.1
+ ----------------------------------------
 diff --git a/_pytest/terminal.py b/_pytest/terminal.py
 --- a/_pytest/terminal.py
 +++ b/_pytest/terminal.py
 diff --git a/testing/test_terminal.py b/testing/test_terminal.py
 --- a/testing/test_terminal.py
 +++ b/testing/test_terminal.py
-@@ -256,6 +256,17 @@ class TestCollectonly:
-             *1 error*
-         """).strip())
+@@ -270,6 +270,17 @@ class TestCollectonly:
+             '*test_fun.py: 1*',
+         ])
  
 +    def test_collectonly_missing_path(self, testdir):
 +        """this checks issue 115,

more-quiet-collectonly

 # HG changeset patch
-# Parent 8036a29a3f8c63c6553122303545f0f0009a596f
+# Parent 29ec3dec63891b8e4f633ef4fed13c61b9e4ccb2
 more quit collectonly shows only files and the number of tests in them
 
+diff --git a/CHANGELOG b/CHANGELOG
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -14,6 +14,8 @@ Changes between 2.2.1 and 2.2.2.dev
+ - fix crash resulting from calling monkeypatch undo a second time
+ - extend reports accepting kwargs to set arbitrary additional attributes
+   this helps xdist serialization/deserialization of extended/customized reports
++- add support for more quiet collectonly, which only prints the number of tests per file,
++  instead of the nodeids
+ 
+ Changes between 2.2.0 and 2.2.1
+ ----------------------------------------
 diff --git a/_pytest/terminal.py b/_pytest/terminal.py
 --- a/_pytest/terminal.py
 +++ b/_pytest/terminal.py
              return
          stack = []
          indent = ""
+diff --git a/testing/test_terminal.py b/testing/test_terminal.py
+--- a/testing/test_terminal.py
++++ b/testing/test_terminal.py
+@@ -256,6 +256,20 @@ class TestCollectonly:
+             *1 error*
+         """).strip())
+ 
++    def test_collectonly_quiet(self, testdir):
++        testdir.makepyfile("def test_foo(): pass")
++        result = testdir.runpytest("--collectonly", "-q")
++        result.stdout.fnmatch_lines([
++            '*test_foo*',
++        ])
++
++    def test_collectonly_quiet(self, testdir):
++        testdir.makepyfile(test_fun="def test_foo(): pass")
++        result = testdir.runpytest("--collectonly", "-qq")
++        result.stdout.fnmatch_lines([
++            '*test_fun.py: 1*',
++        ])
++
+ 
+ def test_repr_python_version(monkeypatch):
+     try: