Skip to content

Commit 0463cac

Browse files
committed
clean up after tests
1 parent 7a9ed8f commit 0463cac

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

coverage.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ wvpy/render_workbook.py 54 54 0%
1717
TOTAL 461 251 46%
1818

1919

20-
============================= 10 passed in 29.14s ==============================
20+
============================= 10 passed in 31.42s ==============================
0 Bytes
Binary file not shown.

pkg/dist/wvpy-0.4.1.tar.gz

14 Bytes
Binary file not shown.

pkg/tests/test_nb_fns.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ def test_jupyter_notebook_good():
3737
source_dir = os.path.dirname(os.path.realpath(__file__))
3838
orig_wd = os.getcwd()
3939
os.chdir(source_dir)
40+
try:
41+
os.remove("example_good_notebook.html")
42+
except FileNotFoundError:
43+
pass
4044
render_as_html(
4145
"example_good_notebook.ipynb"
4246
)
@@ -49,17 +53,27 @@ def test_jupyter_notebook_bad():
4953
source_dir = os.path.dirname(os.path.realpath(__file__))
5054
orig_wd = os.getcwd()
5155
os.chdir(source_dir)
56+
try:
57+
os.remove("example_bad_notebook.html")
58+
except FileNotFoundError:
59+
pass
5260
with pytest.raises(CellExecutionError):
5361
render_as_html(
5462
"example_bad_notebook.ipynb"
5563
)
64+
os.remove("example_bad_notebook.html")
5665
os.chdir(orig_wd)
5766

5867

5968
def test_pool_completes_bad():
6069
source_dir = os.path.dirname(os.path.realpath(__file__))
6170
orig_wd = os.getcwd()
6271
os.chdir(source_dir)
72+
for nm in ["example_good_notebook.html", "example_parameterized_notebook.html"]:
73+
try:
74+
os.remove(nm)
75+
except FileNotFoundError:
76+
pass
6377
tasks = [
6478
JTask("example_good_notebook.ipynb"),
6579
JTask("example_parameterized_notebook.ipynb"),
@@ -70,13 +84,20 @@ def test_pool_completes_bad():
7084
verbose=False,
7185
stop_on_error=False,
7286
)
87+
for nm in ["example_good_notebook.html", "example_parameterized_notebook.html"]:
88+
os.remove(nm)
7389
os.chdir(orig_wd)
7490

7591

7692
def test_pool_stops_bad():
7793
source_dir = os.path.dirname(os.path.realpath(__file__))
7894
orig_wd = os.getcwd()
7995
os.chdir(source_dir)
96+
for nm in ["example_good_notebook.html", "example_parameterized_notebook.html"]:
97+
try:
98+
os.remove(nm)
99+
except FileNotFoundError:
100+
pass
80101
tasks = [
81102
JTask("example_good_notebook.ipynb"),
82103
JTask("example_parameterized_notebook.ipynb"),
@@ -88,13 +109,19 @@ def test_pool_stops_bad():
88109
verbose=False,
89110
stop_on_error=True,
90111
)
112+
for nm in ["example_good_notebook.html", "example_parameterized_notebook.html"]:
113+
os.remove(nm)
91114
os.chdir(orig_wd)
92115

93116

94117
def test_jupyter_notebook_parameterized_good():
95118
source_dir = os.path.dirname(os.path.realpath(__file__))
96119
orig_wd = os.getcwd()
97120
os.chdir(source_dir)
121+
try:
122+
os.remove("example_parameterized_notebook.html")
123+
except FileNotFoundError:
124+
pass
98125
render_as_html(
99126
"example_parameterized_notebook.ipynb",
100127
init_code='x = 2',
@@ -108,10 +135,15 @@ def test_jupyter_notebook_parameterized_bad():
108135
source_dir = os.path.dirname(os.path.realpath(__file__))
109136
orig_wd = os.getcwd()
110137
os.chdir(source_dir)
138+
try:
139+
os.remove("example_parameterized_notebook.html")
140+
except FileNotFoundError:
141+
pass
111142
with pytest.raises(CellExecutionError):
112143
render_as_html(
113144
"example_parameterized_notebook.ipynb",
114145
)
146+
os.remove("example_parameterized_notebook.html")
115147
# want the raised issue if not present
116148
os.chdir(orig_wd)
117149

@@ -129,6 +161,10 @@ def test_jtask_param_good():
129161
assert isinstance(task_str, str)
130162
back = eval(task_str)
131163
assert task == back
164+
try:
165+
os.remove("example_parameterized_notebook_z.html")
166+
except FileNotFoundError:
167+
pass
132168
with multiprocessing.Pool(2) as p:
133169
p.map(job_fn, [task])
134170
os.remove("example_parameterized_notebook_z.html")
@@ -140,13 +176,18 @@ def test_jtask_param_bad():
140176
source_dir = os.path.dirname(os.path.realpath(__file__))
141177
orig_wd = os.getcwd()
142178
os.chdir(source_dir)
179+
try:
180+
os.remove("example_parameterized_notebook.html")
181+
except FileNotFoundError:
182+
pass
143183
task = JTask(
144184
"example_parameterized_notebook.ipynb",
145185
init_code='x = 1',
146186
)
147187
with pytest.raises(CellExecutionError):
148188
with multiprocessing.Pool(2) as p:
149189
p.map(job_fn, [task])
190+
os.remove("example_parameterized_notebook.html")
150191
# want the raised issue if not present
151192
os.chdir(orig_wd)
152193

0 commit comments

Comments
 (0)