2 new commits in pytest:

https://bitbucket.org/hpk42/pytest/changeset/1d2727fd33f9/
changeset:   1d2727fd33f9
user:        RonnyPfannschmidt
date:        2012-08-22 21:20:18
summary:     correctly have the test for issue #[C179 actually fail
affected #:  1 file

diff -r c0af4c88b90e5230386f0378da674184ef980c38 -r 
1d2727fd33f984f7c4860e803c39809721b074e6 testing/test_python.py
--- a/testing/test_python.py
+++ b/testing/test_python.py
@@ -1668,12 +1668,16 @@
     def test_factory_uses_unknown_funcarg_error(self, testdir):
         testdir.makepyfile("""
             import pytest
-            
-            @pytest.factory(scope='session')
-            def arg1(missing):
+
+            @pytest.factory()
+            def fail(missing):
                 return
 
-            def test_missing(arg1):
+            @pytest.factory()
+            def call_fail(fail):
+                return
+
+            def test_missing(call_fail):
                 pass
             """)
         result = testdir.runpytest()



https://bitbucket.org/hpk42/pytest/changeset/7aab1fcc72cd/
changeset:   7aab1fcc72cd
user:        RonnyPfannschmidt
date:        2012-08-22 21:43:42
summary:     fix issue 179 - propperly show the dependency chain of factories 
on setup failure
affected #:  3 files

diff -r 1d2727fd33f984f7c4860e803c39809721b074e6 -r 
7aab1fcc72cd250cb161231bce28bf57559d5f01 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -35,6 +35,8 @@
 
 - fix issue128: show captured output when capsys/capfd are used
 
+- fix issue179: propperly show the dependency chain of factories
+
 - pluginmanager.register(...) now raises ValueError if the
   plugin has been already registered or the name is taken
 


diff -r 1d2727fd33f984f7c4860e803c39809721b074e6 -r 
7aab1fcc72cd250cb161231bce28bf57559d5f01 _pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -1211,8 +1211,14 @@
 
     def toterminal(self, tw):
         tw.line()
-        for line in self.factblines or []:
-            tw.line(line)
+        if self.factblines:
+            tw.line('    dependency of:')
+            for factorydef in self.factblines:
+                tw.line('        %s in %s' % (
+                    factorydef.argname,
+                    factorydef.baseid,
+                ))
+            tw.line()
         for line in self.deflines:
             tw.line("    " + line.strip())
         for line in self.errorstring.split("\n"):


diff -r 1d2727fd33f984f7c4860e803c39809721b074e6 -r 
7aab1fcc72cd250cb161231bce28bf57559d5f01 testing/test_python.py
--- a/testing/test_python.py
+++ b/testing/test_python.py
@@ -1664,8 +1664,7 @@
             "*2 passed*"
         ])
 
-    @pytest.mark.xfail(reason="factorydef passed to tw.line")
-    def test_factory_uses_unknown_funcarg_error(self, testdir):
+    def test_factory_uses_unknown_funcarg_as_dependency_error(self, testdir):
         testdir.makepyfile("""
             import pytest
 
@@ -1682,7 +1681,10 @@
             """)
         result = testdir.runpytest()
         result.stdout.fnmatch_lines([
-            "*LookupError: no factory found for argument 'missing'"
+            "*dependency of:*",
+            "*call_fail*",
+            "*def fail(*",
+            "*LookupError: no factory found for argument 'missing'",
         ])

Repository URL: https://bitbucket.org/hpk42/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.
_______________________________________________
py-svn mailing list
py-svn@codespeak.net
http://codespeak.net/mailman/listinfo/py-svn

Reply via email to