Commit 6e1eac6f authored by u214892's avatar u214892
Browse files

#57 run tests, examples, notebooks from other directory

parent f51c77cb
Pipeline #1129 passed with stage
in 11 minutes and 13 seconds
......@@ -68,6 +68,14 @@ def get_all_svg_files(directory='./svg/'):
return ret
def get_all_images_files(directory='./images/'):
ret = []
for f in os.listdir(directory):
if os.path.isfile(os.path.join(directory, f)):
ret.append(directory + f)
return ret
# Gather requirements from requirements_dev.txt
install_reqs = []
requirements_path = 'requirements_dev.txt'
......@@ -103,7 +111,7 @@ setup(
keywords='flatland',
name='flatland-rl',
packages=find_packages('.'),
data_files=[('svg', get_all_svg_files())],
data_files=[('svg', get_all_svg_files()), ('images', get_all_images_files())],
setup_requires=setup_requirements,
test_suite='tests',
tests_require=test_requirements,
......
......@@ -76,10 +76,10 @@ whitelist_externals = sh
deps =
-r{toxinidir}/requirements_dev.txt
commands =
sh -c 'echo DISPLAY=$DISPLAY'
sh -c 'echo XAUTHORITY=$XAUTHORITY'
; run examples from subfolder to ensure that resources are accessed via resources and not via relative paths
sh -c 'mkdir -p {envtmpdir}/c236d3c240d61a0969d4cb59e2180ce5'
; pipe echo into python since some examples expect input to close the window after the example is run
sh -c 'ls examples/*.py | xargs -I{} -n 1 sh -c "echo -e \"\n====== Running {} ========\n\"; echo "q" | python {}"'
sh -c 'cd {envtmpdir}/c236d3c240d61a0969d4cb59e2180ce5 && ls {toxinidir}/examples/*.py | xargs -I{} -n 1 sh -c "echo -e \"\n====== Running {} ========\n\"; echo "q" | python {}"'
[testenv:notebooks]
basepython = python
......@@ -96,11 +96,13 @@ deps =
-r{toxinidir}/requirements_dev.txt
-r{toxinidir}/requirements_continuous_integration.txt
commands =
; run tests from subfolder to ensure that resources are accessed via resources and not via relative paths
sh -c 'mkdir -p {envtmpdir}/6f59bc68108c3895b1828abdd04b9a06'
sh -c 'jupyter nbextension enable --py --sys-prefix widgetsnbextension'
sh -c 'jupyter nbextension enable --py --sys-prefix jpy_canvas'
; https://stackoverflow.com/questions/35545402/how-to-run-an-ipynb-jupyter-notebook-from-terminal/35545463
sh -c 'ls notebooks/*.ipynb | xargs -n 1 jupyter nbconvert --to python'
sh -c 'ls notebooks/*.py | xargs -I{} -n 1 sh -c "echo -e \"\n====== Running {} ========\n\"; ipython {}"'
sh -c 'cd {envtmpdir}/6f59bc68108c3895b1828abdd04b9a06 && ls {toxinidir}/notebooks/*.py | xargs -I{} -n 1 sh -c "echo -e \"\n====== Running {} ========\n\"; ipython {}"'
[testenv]
whitelist_externals = sh
......@@ -115,5 +117,6 @@ passenv =
deps =
-r{toxinidir}/requirements_dev.txt
commands =
sh -c 'echo DISPLAY: $DISPLAY'
py.test --basetemp={envtmpdir}
; run tests from subfolder to ensure that resources are accessed via resources and not via relative paths
sh -c 'mkdir -p {envtmpdir}/fefed3ba12bf1ed81dbcc20fb52706ea'
sh -c 'cd {envtmpdir}/fefed3ba12bf1ed81dbcc20fb52706ea && py.test --basetemp={envtmpdir} {toxinidir}'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment