1 new changeset in pytest-xdist: http://bitbucket.org/hpk42/pytest-xdist/changeset/cafe8e5d645b/ changeset: r101:cafe8e5d645b user: hpk42 date: 2011-04-14 21:35:27 summary: fix race condition as reported by Ralf Schmitt affected #: 3 files (714 bytes)
--- a/CHANGELOG Wed Mar 16 17:59:14 2011 +0100 +++ b/CHANGELOG Thu Apr 14 21:35:27 2011 +0200 @@ -5,6 +5,9 @@ - fix issue34 - distributed testing with -p plugin now works correctly +- fix race condition in looponfail mode where a concurrent file removal + could cause a crash + 1.5 ------------------------- --- a/testing/test_looponfail.py Wed Mar 16 17:59:14 2011 +0100 +++ b/testing/test_looponfail.py Thu Apr 14 21:35:27 2011 +0200 @@ -14,11 +14,11 @@ changed = sd.check() assert changed - tmp.ensure("new.py") + p = tmp.ensure("new.py") changed = sd.check() assert changed - tmp.join("new.py").remove() + p.remove() changed = sd.check() assert changed @@ -36,6 +36,24 @@ changed = sd.check() assert changed + def test_filechange_deletion_race(self, tmpdir, monkeypatch): + tmp = tmpdir + sd = StatRecorder([tmp]) + changed = sd.check() + assert not changed + + p = tmp.ensure("new.py") + changed = sd.check() + assert changed + + p.remove() + # make check()'s visit() call return our just removed + # path as if we were in a race condition + monkeypatch.setattr(tmp, 'visit', lambda *args: [p]) + + changed = sd.check() + assert changed + def test_pycremoval(self, tmpdir): tmp = tmpdir hello = tmp.ensure("hello.py") --- a/xdist/looponfail.py Wed Mar 16 17:59:14 2011 +0100 +++ b/xdist/looponfail.py Thu Apr 14 21:35:27 2011 +0200 @@ -201,14 +201,11 @@ newstat = {} for rootdir in self.rootdirlist: for path in rootdir.visit(self.fil, self.rec): - oldstat = statcache.get(path, None) - if oldstat is not None: - del statcache[path] + oldstat = statcache.pop(path, None) try: newstat[path] = curstat = path.stat() except py.error.ENOENT: if oldstat: - del statcache[path] changed = True else: if oldstat: Repository URL: https://bitbucket.org/hpk42/pytest-xdist/ -- 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