[Pytest-commit] commit/pytest: hpk42: Merged in hpk42/pytest-patches/plugtestfix (pull request #283)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Apr 28 11:52:58 CEST 2015


1 new commit in pytest:

https://bitbucket.org/pytest-dev/pytest/commits/a2dfd7c1fb40/
Changeset:   a2dfd7c1fb40
User:        hpk42
Date:        2015-04-28 09:52:53+00:00
Summary:     Merged in hpk42/pytest-patches/plugtestfix (pull request #283)

make test suite more tolerable against xdist causing warnings itself
Affected #:  7 files

diff -r 24f4d48abeeb28d15a7a43249c7329dbea2df1d8 -r a2dfd7c1fb40818cf8b61e17ebf30b0ed287918e _pytest/pytester.py
--- a/_pytest/pytester.py
+++ b/_pytest/pytester.py
@@ -238,6 +238,13 @@
                         d[cat] = int(num)
                     return d
 
+    def assertoutcome(self, passed=0, skipped=0, failed=0):
+        d = self.parseoutcomes()
+        assert passed == d.get("passed", 0)
+        assert skipped == d.get("skipped", 0)
+        assert failed == d.get("failed", 0)
+
+
 class TmpTestdir:
     """Temporary test directory with tools to test/run py.test itself.
 
@@ -872,6 +879,7 @@
         lines1 = val.split("\n")
         return LineMatcher(lines1).fnmatch_lines(lines2)
 
+
 class LineMatcher:
     """Flexible matching of text.
 

diff -r 24f4d48abeeb28d15a7a43249c7329dbea2df1d8 -r a2dfd7c1fb40818cf8b61e17ebf30b0ed287918e testing/python/collect.py
--- a/testing/python/collect.py
+++ b/testing/python/collect.py
@@ -58,14 +58,10 @@
             class TestClass1:
                 def __init__(self):
                     pass
-            class TestClass2(object):
-                def __init__(self):
-                    pass
         """)
         result = testdir.runpytest("-rw")
-        result.stdout.fnmatch_lines("""
+        result.stdout.fnmatch_lines_random("""
             WC1*test_class_with_init_warning.py*__init__*
-            *2 warnings*
         """)
 
     def test_class_subclassobject(self, testdir):

diff -r 24f4d48abeeb28d15a7a43249c7329dbea2df1d8 -r a2dfd7c1fb40818cf8b61e17ebf30b0ed287918e testing/python/metafunc.py
--- a/testing/python/metafunc.py
+++ b/testing/python/metafunc.py
@@ -375,9 +375,7 @@
                     assert metafunc.cls == TestClass
         """)
         result = testdir.runpytest(p, "-v")
-        result.stdout.fnmatch_lines([
-            "*2 passed in*",
-        ])
+        result.assertoutcome(passed=2)
 
     def test_addcall_with_two_funcargs_generators(self, testdir):
         testdir.makeconftest("""

diff -r 24f4d48abeeb28d15a7a43249c7329dbea2df1d8 -r a2dfd7c1fb40818cf8b61e17ebf30b0ed287918e testing/test_config.py
--- a/testing/test_config.py
+++ b/testing/test_config.py
@@ -368,9 +368,8 @@
             def pytest_configure(config):
                 config.warn("C1", "hello")
             def pytest_logwarning(code, message):
-                assert code == "C1"
-                assert message == "hello"
-                l.append(1)
+                if message == "hello" and code == "C1":
+                    l.append(1)
         """)
         testdir.makepyfile("""
             def test_proper(pytestconfig):
@@ -391,15 +390,13 @@
                 pass
         """)
         result = testdir.runpytest()
-        result.stdout.fnmatch_lines("""
-            *1 warning*
-        """)
+        assert result.parseoutcomes()["warnings"] > 0
         assert "hello" not in result.stdout.str()
+
         result = testdir.runpytest("-rw")
         result.stdout.fnmatch_lines("""
             ===*warning summary*===
             *WT1*test_warn_on_test_item*:5*hello*
-            *1 warning*
         """)
 
 class TestRootdir:

diff -r 24f4d48abeeb28d15a7a43249c7329dbea2df1d8 -r a2dfd7c1fb40818cf8b61e17ebf30b0ed287918e testing/test_nose.py
--- a/testing/test_nose.py
+++ b/testing/test_nose.py
@@ -339,9 +339,7 @@
             assert False
         """)
     result = testdir.runpytest(p)
-    outcome = result.parseoutcomes()
-    outcome.pop('seconds')
-    assert outcome == dict(skipped=1)
+    result.assertoutcome(skipped=1)
 
 
 def test_SkipTest_in_test(testdir):

diff -r 24f4d48abeeb28d15a7a43249c7329dbea2df1d8 -r a2dfd7c1fb40818cf8b61e17ebf30b0ed287918e testing/test_terminal.py
--- a/testing/test_terminal.py
+++ b/testing/test_terminal.py
@@ -412,7 +412,7 @@
                 py.std.sys.platform, verinfo,
                 py.__version__, pytest.__version__),
             "*test_header_trailer_info.py .",
-            "=* 1 passed in *.[0-9][0-9] seconds *=",
+            "=* 1 passed*in *.[0-9][0-9] seconds *=",
         ])
         if pytest.config.pluginmanager._plugin_distinfo:
             result.stdout.fnmatch_lines([

diff -r 24f4d48abeeb28d15a7a43249c7329dbea2df1d8 -r a2dfd7c1fb40818cf8b61e17ebf30b0ed287918e tox.ini
--- a/tox.ini
+++ b/tox.ini
@@ -34,7 +34,7 @@
 deps={[testenv:py27-xdist]deps}
 commands=
   py.test -n3 -rfsxX \
-        --junitxml={envlogdir}/junit-{envname}.xml testing
+        --junitxml={envlogdir}/junit-{envname}.xml {posargs:testing}
 
 [testenv:py27-pexpect]
 changedir=testing

Repository URL: https://bitbucket.org/pytest-dev/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the pytest-commit mailing list