parent
726a9550db
commit
5338ff4808
|
@ -83,16 +83,16 @@ print(article.headline)"""
|
||||||
with NamedTemporaryFile(mode='w+', suffix=".py", dir='.') as script:
|
with NamedTemporaryFile(mode='w+', suffix=".py", dir='.') as script:
|
||||||
script.write(script_template % pickle.dumps(a))
|
script.write(script_template % pickle.dumps(a))
|
||||||
script.flush()
|
script.flush()
|
||||||
try:
|
|
||||||
result = subprocess.check_output(
|
|
||||||
[sys.executable, script.name],
|
|
||||||
env = {
|
env = {
|
||||||
# Needed to run test outside of tests directory
|
# Needed to run test outside of tests directory
|
||||||
str('PYTHONPATH'): os.pathsep.join(sys.path),
|
str('PYTHONPATH'): os.pathsep.join(sys.path),
|
||||||
# Needed on Windows because http://bugs.python.org/issue8557
|
# Needed on Windows because http://bugs.python.org/issue8557
|
||||||
str('PATH'): os.environ['PATH'],
|
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=env)
|
||||||
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")
|
||||||
|
|
Loading…
Reference in New Issue