1 new changeset in pytest:

http://bitbucket.org/hpk42/pytest/changeset/cde87e253f59/
changeset:   r2132:cde87e253f59
user:        hpk
date:        2011-01-11 15:54:47
summary:     remove same-conftest.py detection - does more harm than good
(see mail from Ralf Schmitt on py-dev)
affected #:  3 files (1.0 KB)

--- a/CHANGELOG Thu Dec 23 14:56:38 2010 -0600
+++ b/CHANGELOG Tue Jan 11 15:54:47 2011 +0100
@@ -1,6 +1,8 @@
 Changes between 2.0.0 and 2.0.1.devX
 ----------------------------------------------
 
+- remove somewhat surprising "same-conftest" detection because
+  it ignores conftest.py when they appear in several subdirs.
 - improve assertions ("not in"), thanks Floris
 - improve behaviour/warnings when running on top of "python -OO"
   (assertions and docstrings are turned off, leading to potential


--- a/_pytest/config.py Thu Dec 23 14:56:38 2010 -0600
+++ b/_pytest/config.py Tue Jan 11 15:54:47 2011 +0100
@@ -125,7 +125,6 @@
         self._onimport = onimport
         self._conftestpath2mod = {}
         self._confcutdir = confcutdir
-        self._md5cache = {}
 
     def setinitial(self, args):
         """ try to find a first anchor path for looking up global values
@@ -179,14 +178,7 @@
                 else:
                     conftestpath = path.join("conftest.py")
                     if conftestpath.check(file=1):
-                        key = conftestpath.computehash()
-                        # XXX logging about conftest loading
-                        if key not in self._md5cache:
-                            clist.append(self.importconftest(conftestpath))
-                            self._md5cache[key] = conftestpath
-                        else:
-                            # use some kind of logging
-                            print ("WARN: not loading %s" % conftestpath)
+                        clist.append(self.importconftest(conftestpath))
                 clist[:0] = self.getconftestmodules(dp)
             self._path2confmods[path] = clist
         # be defensive: avoid changes from caller side to


--- a/testing/test_conftest.py  Thu Dec 23 14:56:38 2010 -0600
+++ b/testing/test_conftest.py  Tue Jan 11 15:54:47 2011 +0100
@@ -170,21 +170,6 @@
         assert conftest.getconftestmodules(sub) == []
         assert conftest.getconftestmodules(conf.dirpath()) == []
 
-def test_conftest_samecontent_detection(testdir):
-    conf = testdir.makeconftest("x=3")
-    p = testdir.mkdir("x")
-    conf.copy(p.join("conftest.py"))
-    conftest = Conftest()
-    conftest.setinitial([p])
-    l = conftest.getconftestmodules(p)
-    assert len(l) == 1
-    assert l[0].__file__ == p.join("conftest.py")
-    p2 = p.mkdir("y")
-    conf.copy(p2.join("conftest.py"))
-    l = conftest.getconftestmodules(p2)
-    assert len(l) == 1
-    assert l[0].__file__ == p.join("conftest.py")
-
 @pytest.mark.multi(name='test tests whatever .dotdir'.split())
 def test_setinitial_conftest_subdirs(testdir, name):
     sub = testdir.mkdir(name)

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