forked from bokeh/bokeh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_python_execution_with_OO.py
More file actions
39 lines (27 loc) · 1.12 KB
/
test_python_execution_with_OO.py
File metadata and controls
39 lines (27 loc) · 1.12 KB
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 __future__ import print_function
import os
import subprocess
def test_python_execution_with_OO():
# running python with -OO will discard docstrings -> __doc__ is None
# We have this test to make sure that the deployed code will still run.
# If you ever encounter a new problem with docstrings being formatted try using format_docstring.
imports = []
for path, dirs, files in os.walk("bokeh"):
if "tests" in path: continue
for file in files:
if not file.endswith(".py"):
continue
if file.endswith("__main__.py"):
continue
if file.endswith("__init__.py"):
mod = path.replace("/", ".")
else:
mod = path.replace("/", ".") + "." + file[:-3]
imports.append("import " + mod)
test_env = os.environ.copy()
test_env['BOKEH_DOCS_MISSING_API_KEY_OK'] = 'yes'
proc = subprocess.Popen(["python", "-OO", "-c", ";".join(imports), ''], stdout=subprocess.PIPE, env=test_env)
out, errs = proc.communicate()
proc.wait()
if proc.returncode != 0:
assert False