aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorBonfaceKilz2020-07-26 23:18:54 +0300
committerBonfaceKilz2020-07-26 23:19:51 +0300
commitc1143ffc544abf9c4f12d6676d2584ef1d1cb95e (patch)
tree55809093385ad5b991c703c3ea00eeeec5605cab /README.md
parent5a63137af7e383bbae867c4385c42cacf0d78b8e (diff)
downloadgenenetwork2-c1143ffc544abf9c4f12d6676d2584ef1d1cb95e.tar.gz
Document how to run tests
* README.md: - Add details on how to run unit tests - Update link that points to Mechanical Rob
Diffstat (limited to 'README.md')
-rw-r--r--README.md34
1 files changed, 32 insertions, 2 deletions
diff --git a/README.md b/README.md
index 47519118..45aca1b2 100644
--- a/README.md
+++ b/README.md
@@ -40,9 +40,13 @@ Also Mysql and Elasticsearch need to be running, see
## Testing
+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/master/test/lib)
-which can be run with something like
+[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
@@ -54,6 +58,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