diff options
author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2015-02-21 19:18:54 +0100 |
---|---|---|
committer | Aymeric Augustin <aymeric.augustin@oscaro.com> | 2015-02-23 16:55:27 +0100 |
commit | a8fe12417f778a76837f8e4f8503779f52a396ba (patch) | |
tree | fa3d9fc9e86cbfa4eb796e6e68c2692b859746e8 /tests/model_regress | |
parent | 934400759de817471ff37d736686201d7ae34e82 (diff) | |
download | django-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.py | 6 |
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 |