Skip to content

Commit

Permalink
TEST examples: execfile() -> exec()
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbrodbeck committed Feb 6, 2017
1 parent 9f2d2f7 commit 043085f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions eelbrain/tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,17 @@ def run_example(example_path, name):
# copy all files to temporary dir
tempdir = mkdtemp()
try:
exec_path = os.path.join(tempdir, example_filename)
with open(exec_path, 'w') as fid:
fid.write(text)
logging.info("Tempdir for %s at %s" % (name, tempdir))
for filename in required_files:
src = os.path.join(dirname, filename)
logging.info(" Copying %s" % (filename,))
shutil.copy(src, tempdir)

# execute example
logging.info("executing %s from %s" % (name, tempdir))
plot.configure(show=False)
os.chdir(tempdir)
execfile(example_filename, {})
logging.info(" Executing %s" % (name,))
plot.configure(show=False)
exec(text, {})
finally:
# delete temporary files
shutil.rmtree(tempdir)
Expand Down

0 comments on commit 043085f

Please sign in to comment.