summaryrefslogtreecommitdiff
path: root/tests/model_regress
diff options
context:
space:
mode:
authorCollin Anderson <cmawebsite@gmail.com>2015-01-16 11:41:14 -0500
committerTim Graham <timograham@gmail.com>2015-01-16 11:59:08 -0500
commit5338ff4808c822a8b00e90154b884b7be3011e60 (patch)
tree4b96e576e1d3d1842d43578ed514de683e67eea9 /tests/model_regress
parent726a9550db5129badc1c44809b0bed728fa1ad90 (diff)
downloaddjango-5338ff4808c822a8b00e90154b884b7be3011e60.tar.gz
Fixed #24160 -- Fixed model_regress test on Windows; refs #24007.
Diffstat (limited to 'tests/model_regress')
-rw-r--r--tests/model_regress/test_pickle.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/model_regress/test_pickle.py b/tests/model_regress/test_pickle.py
index b0e3fa9d66..5348b4a495 100644
--- a/tests/model_regress/test_pickle.py
+++ b/tests/model_regress/test_pickle.py
@@ -83,16 +83,16 @@ print(article.headline)"""
with NamedTemporaryFile(mode='w+', suffix=".py", dir='.') as script:
script.write(script_template % pickle.dumps(a))
script.flush()
+ env = {
+ # Needed to run test outside of tests directory
+ str('PYTHONPATH'): os.pathsep.join(sys.path),
+ # Needed on Windows because http://bugs.python.org/issue8557
+ str('PATH'): os.environ['PATH'],
+ }
+ if 'SYSTEMROOT' in os.environ: # Windows http://bugs.python.org/issue20614
+ env[str('SYSTEMROOT')] = os.environ['SYSTEMROOT']
try:
- result = subprocess.check_output(
- [sys.executable, script.name],
- env={
- # Needed to run test outside of tests directory
- str('PYTHONPATH'): os.pathsep.join(sys.path),
- # Needed on Windows because http://bugs.python.org/issue8557
- str('PATH'): os.environ['PATH'],
- }
- )
+ result = subprocess.check_output([sys.executable, script.name], env=env)
except subprocess.CalledProcessError:
self.fail("Unable to reload model pickled data")
self.assertEqual(result.strip().decode(), "Some object")