[py-svn] r38207 - in py/trunk/py/test: . testing
hpk at codespeak.net
hpk at codespeak.net
Thu Feb 8 21:32:01 CET 2007
Author: hpk
Date: Thu Feb 8 21:31:50 2007
New Revision: 38207
Modified:
py/trunk/py/test/config.py
py/trunk/py/test/testing/test_config.py
Log:
revert 38182 and 38184 changes to ensuretemp()
because getpid() is different per thread
(and if e.g. run via execnet in threads ...
it creates new tempdirectories all the time)
let's consider this sometime else
Modified: py/trunk/py/test/config.py
==============================================================================
--- py/trunk/py/test/config.py (original)
+++ py/trunk/py/test/config.py Thu Feb 8 21:31:50 2007
@@ -6,17 +6,15 @@
optparse = py.compat.optparse
-def ensuretemp(string, dir=1, _pid2dir={}):
+# XXX move to Config class
+basetemp = None
+def ensuretemp(string, dir=1):
""" return temporary directory path with
the given string as the trailing part.
"""
- # we may be in a forking situation and want to use
- # separate dirs then (XXX or not?)
- pid = py.std.os.getpid()
- basetemp = _pid2dir.get(pid, None)
+ global basetemp
if basetemp is None:
basetemp = py.path.local.make_numbered_dir(prefix='pytest-')
- _pid2dir[pid] = basetemp
return basetemp.ensure(string, dir=dir)
class CmdOptions(object):
Modified: py/trunk/py/test/testing/test_config.py
==============================================================================
--- py/trunk/py/test/testing/test_config.py (original)
+++ py/trunk/py/test/testing/test_config.py Thu Feb 8 21:31:50 2007
@@ -10,21 +10,6 @@
assert d1 == d2
assert d1.check(dir=1)
-def test_ensuretemp_fork():
- os = py.std.os
- org_getpid = os.getpid
- currpid = 0
- def getpid():
- return currpid
- try:
- os.getpid = getpid
- d1 = py.test.ensuretemp('hello')
- currpid = 1
- d2 = py.test.ensuretemp('hello')
- finally:
- os.getpid = org_getpid
- assert d1 != d2
-
def test_config_cmdline_options():
o = py.test.ensuretemp('configoptions')
o.ensure("conftest.py").write(py.code.Source("""
More information about the pytest-commit
mailing list