We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8c54875 commit 383ff17Copy full SHA for 383ff17
code/tests/test_code_in_scripts.py
@@ -12,12 +12,13 @@ def run_py(path):
12
os.chdir(py_dir)
13
14
with open(path, 'r') as f:
15
- content = f.read()
+ content = [line for line in f.readlines()
16
+ if not line.startswith('plt.tight_layout()')]
17
18
with open(path, 'w') as f:
- set_backend = "import matplotlib\nmatplotlib.use('Agg')\n"
19
- content = set_backend + content
20
- f.write(content)
+ set_backend = "\n\nimport matplotlib\nmatplotlib.use('Agg')\n\n"
+ content.insert(2, set_backend)
21
+ f.write('\n'.join(content))
22
23
args = ["python", py_path]
24
subprocess.check_output(args)
0 commit comments