Made model_regress unpickling test CWD-independent

Refs #24007. Thanks Tim Graham for his help with the patch.
This commit is contained in:
Claude Paroz 2014-12-18 21:39:15 +01:00
parent 337cd09836
commit 1d9fc5caa9
1 changed files with 4 additions and 1 deletions

View File

@ -83,7 +83,10 @@ print(article.headline)"""
script.write(script_template % pickle.dumps(a)) script.write(script_template % pickle.dumps(a))
script.flush() script.flush()
try: try:
result = subprocess.check_output([sys.executable, script.name]) result = subprocess.check_output(
[sys.executable, script.name],
env={'PYTHONPATH': ':'.join(sys.path)}
)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
self.fail("Unable to reload model pickled data") self.fail("Unable to reload model pickled data")
self.assertEqual(result.strip().decode(), "Some object") self.assertEqual(result.strip().decode(), "Some object")