forked from em212/applied_ds
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_projects.py
More file actions
24 lines (23 loc) · 808 Bytes
/
test_projects.py
File metadata and controls
24 lines (23 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import pytest
import os
import papermill as pm
import glob
@pytest.mark.parametrize('folder', [x[0] for x in os.walk(os.getcwd())\
if (len(x[0].split('/'))\
== len(os.getcwd().split('/'))+1\
and x[0].split('/')[-1][0] not in ['_', '.'])])
def test(folder):
if folder == 'lecture_notes':
pass
os.chdir(folder)
print(os.getcwd())
for notebook in glob.glob('*.ipynb'):
try:
pm.execute_notebook(
notebook,
'result.ipynb')
finally:
assert(os.path.isfile('%s/result.ipynb' % folder)), "Notebook did not run"
os.remove('%s/result.ipynb' % folder)
os.chdir(os.path.dirname(os.getcwd()))
pass