1 new changeset in pytest:

http://bitbucket.org/hpk42/pytest/changeset/bc0e2169d120/
changeset:   r2151:bc0e2169d120
user:        hpk42
date:        2011-02-07 11:09:42
summary:     accept a left out "()" for ids on command line for better 
compatibility with pytest.vim
affected #:  3 files (977 bytes)

--- a/CHANGELOG Fri Feb 04 23:20:27 2011 +0100
+++ b/CHANGELOG Mon Feb 07 11:09:42 2011 +0100
@@ -4,6 +4,8 @@
 - refine and unify initial capturing so that it works nicely
   even if the logging module is used on an early-loaded conftest.py
   file or plugin.
+- allow to omit "()" in test ids to allow for uniform test ids
+  as produced by Alfredo's nice pytest.vim plugin.
 - fix issue12 - show plugin versions with "--version" and
   "--traceconfig" and also document how to add extra information 
   to reporting test header


--- a/_pytest/main.py   Fri Feb 04 23:20:27 2011 +0100
+++ b/_pytest/main.py   Mon Feb 07 11:09:42 2011 +0100
@@ -495,9 +495,15 @@
             node.ihook.pytest_collectstart(collector=node)
             rep = node.ihook.pytest_make_collect_report(collector=node)
             if rep.passed:
+                has_matched = False
                 for x in rep.result:
                     if x.name == name:
                         resultnodes.extend(self.matchnodes([x], nextnames))
+                        has_matched = True
+                # XXX accept IDs that don't have "()" for class instances
+                if not has_matched and len(rep.result) == 1 and x.name == "()":
+                    nextnames.insert(0, name)
+                    resultnodes.extend(self.matchnodes([x], nextnames))
             node.ihook.pytest_collectreport(report=rep)
         return resultnodes
 


--- a/testing/test_collection.py        Fri Feb 04 23:20:27 2011 +0100
+++ b/testing/test_collection.py        Mon Feb 07 11:09:42 2011 +0100
@@ -472,6 +472,21 @@
         item2b, = newcol.perform_collect([item.nodeid], genitems=False)
         assert item2b == item2
 
+    def test_find_byid_without_instance_parents(self, testdir):
+        p = testdir.makepyfile("""
+            class TestClass:
+                def test_method(self):
+                    pass
+        """)
+        arg = p.basename + ("::TestClass::test_method")
+        config = testdir.parseconfig(arg)
+        rcol = Session(config)
+        rcol.perform_collect()
+        items = rcol.items
+        assert len(items) == 1
+        item, = items
+        assert item.nodeid.endswith("TestClass::()::test_method")
+
 class Test_getinitialnodes:
     def test_global_file(self, testdir, tmpdir):
         x = tmpdir.ensure("x.py")

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