Skip to content
Snippets Groups Projects
Commit 6e1eac6f authored by u214892's avatar u214892
Browse files

#57 run tests, examples, notebooks from other directory

parent f51c77cb
No related branches found
No related tags found
No related merge requests found
...@@ -68,6 +68,14 @@ def get_all_svg_files(directory='./svg/'): ...@@ -68,6 +68,14 @@ def get_all_svg_files(directory='./svg/'):
return ret 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 # Gather requirements from requirements_dev.txt
install_reqs = [] install_reqs = []
requirements_path = 'requirements_dev.txt' requirements_path = 'requirements_dev.txt'
...@@ -103,7 +111,7 @@ setup( ...@@ -103,7 +111,7 @@ setup(
keywords='flatland', keywords='flatland',
name='flatland-rl', name='flatland-rl',
packages=find_packages('.'), 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, setup_requires=setup_requirements,
test_suite='tests', test_suite='tests',
tests_require=test_requirements, tests_require=test_requirements,
......
...@@ -76,10 +76,10 @@ whitelist_externals = sh ...@@ -76,10 +76,10 @@ whitelist_externals = sh
deps = deps =
-r{toxinidir}/requirements_dev.txt -r{toxinidir}/requirements_dev.txt
commands = commands =
sh -c 'echo DISPLAY=$DISPLAY' ; run examples from subfolder to ensure that resources are accessed via resources and not via relative paths
sh -c 'echo XAUTHORITY=$XAUTHORITY' sh -c 'mkdir -p {envtmpdir}/c236d3c240d61a0969d4cb59e2180ce5'
; pipe echo into python since some examples expect input to close the window after the example is run ; 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] [testenv:notebooks]
basepython = python basepython = python
...@@ -96,11 +96,13 @@ deps = ...@@ -96,11 +96,13 @@ deps =
-r{toxinidir}/requirements_dev.txt -r{toxinidir}/requirements_dev.txt
-r{toxinidir}/requirements_continuous_integration.txt -r{toxinidir}/requirements_continuous_integration.txt
commands = 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 widgetsnbextension'
sh -c 'jupyter nbextension enable --py --sys-prefix jpy_canvas' 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 ; 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/*.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] [testenv]
whitelist_externals = sh whitelist_externals = sh
...@@ -115,5 +117,6 @@ passenv = ...@@ -115,5 +117,6 @@ passenv =
deps = deps =
-r{toxinidir}/requirements_dev.txt -r{toxinidir}/requirements_dev.txt
commands = commands =
sh -c 'echo DISPLAY: $DISPLAY' ; run tests from subfolder to ensure that resources are accessed via resources and not via relative paths
py.test --basetemp={envtmpdir} sh -c 'mkdir -p {envtmpdir}/fefed3ba12bf1ed81dbcc20fb52706ea'
sh -c 'cd {envtmpdir}/fefed3ba12bf1ed81dbcc20fb52706ea && py.test --basetemp={envtmpdir} {toxinidir}'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment