From cef3f805c21c029d017e6704565f9f2f5746a1e5 Mon Sep 17 00:00:00 2001 From: Collin Anderson Date: Fri, 16 Jan 2015 11:41:14 -0500 Subject: [PATCH] [1.7.x] Fixed #24160 -- Fixed model_regress test on Windows; refs #24007. Backport of 5338ff4808c822a8b00e90154b884b7be3011e60 from master --- tests/model_regress/tests.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/model_regress/tests.py b/tests/model_regress/tests.py index 7e67d50aba..010a895916 100644 --- a/tests/model_regress/tests.py +++ b/tests/model_regress/tests.py @@ -276,16 +276,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")