diff options
author | Pjotr Prins | 2020-07-27 09:13:38 +0100 |
---|---|---|
committer | GitHub | 2020-07-27 09:13:38 +0100 |
commit | 56ad14434435133b9ef90870f50a52bd158bd6ba (patch) | |
tree | 16e0936453576a1c73ea4eff1ae959a32a98348e /README.md | |
parent | 918dcce5f42fcbe9327eb30bac06a69000a1fc8b (diff) | |
parent | 68bd586b05ae5f3cb90829d2a108901b5b1d87a6 (diff) | |
download | genenetwork2-56ad14434435133b9ef90870f50a52bd158bd6ba.tar.gz |
Merge branch 'testing' into testing
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 38 |
1 files changed, 37 insertions, 1 deletions
@@ -41,7 +41,17 @@ Also mariadb and redis need to be running, see ## Testing -We are building 'Mechanical Rob' automated testing using Python. +To have tests pass, the redis and mariadb instance should be running, because of +asserts sprinkled in the code base(these will be removed in due time). + +#### Mechanical Rob +We are building 'Mechanical Rob' automated testing using Python +[requests](https://github.com/genenetwork/genenetwork2/tree/testing/test/requests) +which can be run with: + +```sh +env GN2_PROFILE=~/opt/gn-latest ./bin/genenetwork2 ./etc/default_settings.py -c ../test/requests/test-website.py -a http://localhost:5003 +``` The GN2_PROFILE is the Guix profile that contains all dependencies. The ./bin/genenetwork2 script sets up the environment @@ -49,6 +59,32 @@ and executes test-website.py in a Python interpreter. The -a switch says to run all tests and the URL points to the running GN2 http server. +#### Unit tests + +To run unittests, first `cd` into the genenetwork2 directory: + +```sh +# You can use the coverage tool to run the tests +# You could omit the -v which makes the output verbose +runcmd coverage run -m unittest discover -v + +# Alternatively, you could run the unittests using: +runpython -m unittest discover -v + +# To generate a report in wqflask/coverage_html_report/: +runcmd coverage html +``` + +The `runcmd` and `runpython` are shell aliases defined in the following way: + +```sh +alias runpython="env GN2_PROFILE=~/opt/gn-latest TMPDIR=/tmp SERVER_PORT=5004 GENENETWORK_FILES=/gnu/data/gn2_data/ ./bin/genenetwork2 + +alias runcmd="time env GN2_PROFILE=~/opt/gn-latest TMPDIR=//tmp SERVER_PORT=5004 GENENETWORK_FILES=/gnu/data/gn2_data/ ./bin/genenetwork2 ./etc/default_settings.py -cli" +``` + +Replace some of the env variables as per your use case. + ## Documentation User documentation can be found |