summaryrefslogtreecommitdiff
path: root/tests/model_regress
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2015-02-21 19:18:54 +0100
committerAymeric Augustin <aymeric.augustin@oscaro.com>2015-02-23 16:55:27 +0100
commita8fe12417f778a76837f8e4f8503779f52a396ba (patch)
treefa3d9fc9e86cbfa4eb796e6e68c2692b859746e8 /tests/model_regress
parent934400759de817471ff37d736686201d7ae34e82 (diff)
downloaddjango-a8fe12417f778a76837f8e4f8503779f52a396ba.tar.gz
Normalized usage of the tempfile module.
Specifically stopped using the dir argument.
Diffstat (limited to 'tests/model_regress')
-rw-r--r--tests/model_regress/test_pickle.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/model_regress/test_pickle.py b/tests/model_regress/test_pickle.py
index 96a6470108..086d4ea79a 100644
--- a/tests/model_regress/test_pickle.py
+++ b/tests/model_regress/test_pickle.py
@@ -80,14 +80,16 @@ print(article.headline)"""
article_text="This is an article",
)
- with NamedTemporaryFile(mode='w+', suffix=".py", dir='.') as script:
+ with NamedTemporaryFile(mode='w+', suffix=".py") as script:
script.write(script_template % pickle.dumps(a))
script.flush()
+ pythonpath = [os.path.dirname(script.name)] + sys.path
env = {
# Needed to run test outside of tests directory
- str('PYTHONPATH'): os.pathsep.join(sys.path),
+ str('PYTHONPATH'): os.pathsep.join(pythonpath),
# Needed on Windows because http://bugs.python.org/issue8557
str('PATH'): os.environ['PATH'],
+ str('TMPDIR'): os.environ['TMPDIR'],
str('LANG'): os.environ.get('LANG', ''),
}
if 'SYSTEMROOT' in os.environ: # Windows http://bugs.python.org/issue20614