OpenTreeOfLife / taxomachine

taxonomy graphdb
Other
7 stars 4 forks source link

nosetests: command not found #79

Closed jar398 closed 8 years ago

jar398 commented 10 years ago

On taxomachine master branch, up to date: (venv)bash-3.2$ cd taxomachine (venv)bash-3.2$ export TAXOMACHINE_SERVER=devapi.opentreeoflife.org/taxomachine (venv)bash-3.2$ ./test.sh ./test.sh:8: nosetests: command not found (venv)bash-3.2$

jar398 commented 10 years ago

May I suggest that you only assume that the tester has virtualenv and pip installed. (That would have to be documented in TESTING.md and/or suggested by the script itself if which virtualenv turns up empty.) Then any tests in any repo can install libraries without sudo by using virtualenv. Here's what I did:

(venv)bash-3.2$ which virtualenv /usr/local/bin/virtualenv (venv)bash-3.2$ virtualenv venv New python executable in venv/bin/python Installing setuptools, pip...done. (venv)bash-3.2$ . venv/bin/activate (venv)(venv)bash-3.2$ pip install nose Downloading/unpacking nose Downloading nose-1.3.4.tar.gz (277kB): 277kB downloaded Running setup.py (path:/Users/jar/a/NESCent/ot/repo/taxomachine/venv/build/nose/setup.py) egg_info for package nose

no previously-included directories found matching 'doc/.build'

Installing collected packages: nose Running setup.py install for nose

no previously-included directories found matching 'doc/.build'
Installing nosetests script to /Users/jar/a/NESCent/ot/repo/taxomachine/venv/bin
Installing nosetests-2.7 script to /Users/jar/a/NESCent/ot/repo/taxomachine/venv/bin

Successfully installed nose Cleaning up... (venv)(venv)bash-3.2$ which nosetests /Users/jar/a/NESCent/ot/repo/taxomachine/venv/bin/nosetests (venv)(venv)bash-3.2$ ./test.sh Failure: ImportError (No module named requests) ... ERROR

ERROR: Failure: ImportError (No module named requests)

Traceback (most recent call last): File "/Users/jar/a/NESCent/ot/repo/taxomachine/venv/lib/python2.7/site-packages/nose/loader.py", line 414, in loadTestsFromName addr.filename, addr.module) File "/Users/jar/a/NESCent/ot/repo/taxomachine/venv/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath return self.importFromDir(dir_path, fqname) File "/Users/jar/a/NESCent/ot/repo/taxomachine/venv/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "/Users/jar/a/NESCent/ot/repo/taxomachine/tests/curl_tests.py", line 1, in import json, os, requests, sys ImportError: No module named requests


Ran 1 test in 0.001s

FAILED (errors=1) (venv)(venv)bash-3.2$ pip install requests Downloading/unpacking requests Downloading requests-2.4.1-py2.py3-none-any.whl (458kB): 458kB downloaded Installing collected packages: requests Successfully installed requests Cleaning up... (venv)(venv)bash-3.2$ ./test.sh curl_tests.run_test('taxonomy/graphdb/about', {}) ... curl -X POST http://devapi.opentreeoflife.org/taxomachine/ext/taxonomy/graphdb/about -H 'content-type:application/json' -d '{}'ok curl_tests.run_test('taxonomy/graphdb/lica', {'ott_ids': [5551856, 821970, 770319]}) ... curl -X POST http://devapi.opentreeoflife.org/taxomachine/ext/taxonomy/graphdb/lica -H 'content-type:application/json' -d '{"ott_ids": [5551856, 821970, 770319]}'ok curl_tests.run_test('taxonomy/graphdb/lica', {'ott_ids': [515698, 590452, 409712, 643717]}) ... curl -X POST http://devapi.opentreeoflife.org/taxomachine/ext/taxonomy/graphdb/lica -H 'content-type:application/json' -d '{"ott_ids": [515698, 590452, 409712, 643717]}'ok curl_tests.run_test('taxonomy/graphdb/subtree', {'ott_id': 515698}) ... curl -X POST http://devapi.opentreeoflife.org/taxomachine/ext/taxonomy/graphdb/subtree -H 'content-type:application/json' -d '{"ott_id": 515698}'ok curl_tests.run_test('taxonomy/graphdb/subtree', {'ott_id': 372706}) ... curl -X POST http://devapi.opentreeoflife.org/taxomachine/ext/taxonomy/graphdb/subtree -H 'content-type:application/json' -d '{"ott_id": 372706}'ok curl_tests.run_test('taxonomy/graphdb/taxon', {'include_lineage': True, 'ott_id': 515698}) ... curl -X POST http://devapi.opentreeoflife.org/taxomachine/ext/taxonomy/graphdb/taxon -H 'content-type:application/json' -d '{"include_lineage": true, "ott_id": 515698}'ok curl_tests.run_test('taxonomy/graphdb/taxon', {'ott_id': 766177}) ... curl -X POST http://devapi.opentreeoflife.org/taxomachine/ext/taxonomy/graphdb/taxon -H 'content-type:application/json' -d '{"ott_id": 766177}'ok curl_tests.run_test('taxonomy/graphdb/flags', {}) ... curl -X POST http://devapi.opentreeoflife.org/taxomachine/ext/taxonomy/graphdb/flags -H 'content-type:application/json' -d '{}'ok curl_tests.run_test('taxonomy/graphdb/deprecated_taxa', {}) ... curl -X POST http://devapi.opentreeoflife.org/taxomachine/ext/taxonomy/graphdb/deprecated_taxa -H 'content-type:application/json' -d '{}'ok curl_tests.run_test('tnrs_v2/graphdb/match_names', {'names': ['Aster', 'Symphyotrichum', 'Erigeron', 'Barnadesia']}) ... curl -X POST http://devapi.opentreeoflife.org/taxomachine/ext/tnrs_v2/graphdb/match_names -H 'content-type:application/json' -d '{"names": ["Aster", "Symphyotrichum", "Erigeron", "Barnadesia"]}'ok curl_tests.run_test('tnrs_v2/graphdb/autocomplete_name', {'context_name': 'All life', 'name': 'Endoxyla'}) ... curl -X POST http://devapi.opentreeoflife.org/taxomachine/ext/tnrs_v2/graphdb/autocomplete_name -H 'content-type:application/json' -d '{"context_name": "All life", "name": "Endoxyla"}'ok curl_tests.run_test('tnrs_v2/graphdb/contexts', {}) ... curl -X POST http://devapi.opentreeoflife.org/taxomachine/ext/tnrs_v2/graphdb/contexts -H 'content-type:application/json' -d '{}'ok curl_tests.run_test('tnrs_v2/graphdb/infer_context', {'names': ['Pan', 'Homo', 'Mus', 'Bufo', 'Drosophila']}) ... curl -X POST http://devapi.opentreeoflife.org/taxomachine/ext/tnrs_v2/graphdb/infer_context -H 'content-type:application/json' -d '{"names": ["Pan", "Homo", "Mus", "Bufo", "Drosophila"]}'ok


Ran 13 tests in 2.113s

OK (venv)(venv)bash-3.2$

mtholder commented 10 years ago

The unofficial python convention is to list the dependencies one per line in a requirements file so that

$ pip install -r requirements.txt

installs everything that you need. (see http://pip.readthedocs.org/en/latest/user_guide.html#id8 for details on associating version #s of dependencies).

jar398 commented 10 years ago

This looks good. I would like to be able to invoke test.sh from a meta-test-harness that doesn't know what programming languages are involved in a repo. And it has to run in user mode. These desiderata could be satisfied by the following, if the repo contains tests written in python:

On Sun, Sep 28, 2014 at 12:21 PM, Mark T. Holder notifications@github.com wrote:

The unofficial python convention is to list the dependencies one per line in a requirements file so that

$ pip install -r requirements.txt

installs everything that you need. (see http://pip.readthedocs.org/en/latest/user_guide.html#id8 for details on associating version #s of dependencies).

— Reply to this email directly or view it on GitHub https://github.com/OpenTreeOfLife/taxomachine/issues/79#issuecomment-57090531 .

chinchliff commented 10 years ago

Ok, I've made the required edits to the test scripts in #80. Please have a look and try out the tests.

pmidford commented 9 years ago

The updated test scripts seem to work (both when they pass and when there are problems). Time to close this?