forked from pielstroem/Topics
-
Notifications
You must be signed in to change notification settings - Fork 13
/
integration_test.py
39 lines (33 loc) · 1.32 KB
/
integration_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from subprocess import check_output, STDOUT, CalledProcessError
from nose.plugins.skip import SkipTest
from pathlib import Path
import logging
import re
project_path = Path(__file__).absolute().parent.parent
def run_notebook(notebook_name):
try:
check_output(["jupyter-nbconvert", "--execute",
"--log-level=ERROR",
"--ExecutePreprocessor.iopub_timeout=30",
"--ExecutePreprocessor.timeout=None",
str(Path(project_path, notebook_name))],
stderr=STDOUT, universal_newlines=True)
except FileNotFoundError as e:
raise SkipTest("jupyter-nbconvert not found. Cannot run integration test. "
+ str(e))
except CalledProcessError as e:
message = e.output
cellinfo = re.search('nbconvert.preprocessors.execute.CellExecutionError: (.+)$',
message, re.MULTILINE | re.DOTALL)
if cellinfo:
message = cellinfo.group(1)
logging.error(message)
@SkipTest
def jupyter_lda_test():
run_notebook("Introducing_lda.ipynb")
def jupyter_gensim_test():
run_notebook("Introducing_gensim.ipynb")
def jupyter_MALLET_test():
run_notebook("Introducing_MALLET.ipynb")
def jupyter_integration_test():
run_notebook("IntegrationTest_txt_gensim.ipynb")