Commits

holger krekel committed 6cbbd04

fix slightly wrong verbose output for non subclasses on windows

Comments (0)

Files changed (3)

 - fixed typos in the docs (thanks Victor Garcia, Brianna Laugher) and particular
   thanks to Laura Creighton who also revieved parts of the documentation.
 
+- fix slighly wrong output of verbose progress reporting for classes 
+  (thanks Amaury)
+
 - more precise (avoiding of) deprecation warnings for node.Class|Function accesses
 
 - avoid std unittest assertion helper code in tracebacks (thanks Ronny)

_pytest/terminal.py

             return
         #for i, testarg in enumerate(self.config.args):
         #    self.write_line("test path %d: %s" %(i+1, testarg))
-        
+
     def _printcollecteditems(self, items):
         # to print out items and their parent collectors
         # we take care to leave out Instances aka ()
                 excrepr.reprcrash.toterminal(self._tw)
 
     def _locationline(self, collect_fspath, fspath, lineno, domain):
-        if fspath and fspath != collect_fspath:
+        if fspath and fspath.replace("\\", "/") != collect_fspath:
             fspath = "%s <- %s" % (collect_fspath, fspath)
         if lineno is not None:
             lineno += 1

testing/test_terminal.py

             "*test_p2.py <- *test_p1.py:2: TestMore.test_p1*",
         ])
 
+    def test_itemreport_directclasses_not_shown_as_subclasses(self, testdir):
+        a = testdir.mkpydir("a")
+        a.join("test_hello.py").write(py.code.Source("""
+            class TestClass:
+                def test_method(self):
+                    pass
+        """))
+        result = testdir.runpytest("-v")
+        assert result.ret == 0
+        result.stdout.fnmatch_lines([
+            "*a/test_hello.py*PASS*",
+        ])
+        assert " <- " not in result.stdout.str()
+
     def test_keyboard_interrupt(self, testdir, option):
         p = testdir.makepyfile("""
             def test_foobar():
             "*test_verbose_reporting.py:10: test_gen*FAIL*",
         ])
         assert result.ret == 1
+
         pytestconfig.pluginmanager.skipifmissing("xdist")
         result = testdir.runpytest(p1, '-v', '-n 1')
         result.stdout.fnmatch_lines([
     result.stderr.fnmatch_lines([
         "*registered*PluginManager*"
     ])
-    
+
 
 class TestGenericReporting:
     """ this test class can be subclassed with a different option