Open pdurbin opened 9 years ago
To run the tests, you'll want to clone the repo rather than run from the version installed to your virtual env. The readme could specify that.
Ah, that makes sense. I blew away my virtualenv and made a fresh one. Now I think we should have a requirements.txt
file with something like this:
lxml==3.4.3
requests==2.6.0
bleach==1.4.1
After running pip install -r requirements.txt
I can run the tests like this:
$ cd dataverse/test
$ vim ../settings/local.py
$ export PYTHONPATH="../.."
$ python -m unittest test_dataverse
Please let me know if this is the wrong approach.
That's a fine approach. Because this is intended to be a package, it may be more clear to name the file dev-requirements.txt
, since the package requirements are listed in setup.py
.
you could run pip install -e .
and not need a requirements.txt file.
you could run pip install -e . and not need a requirements.txt file.
Well, that seems to install everything under "REQUIRES" at https://github.com/IQSS/dataverse-client-python/blob/d6e2199f21cddffac37d94d4e39caeaece70ee7e/setup.py#L6 which is certainly useful ("Successfully installed bleach requests lxml dataverse html5lib six") but I'm also interested in installing everything under "TESTS_REQUIRE" at https://github.com/IQSS/dataverse-client-python/blob/d6e2199f21cddffac37d94d4e39caeaece70ee7e/setup.py#L12 so I can run the tests. Any ideas?
@pdurbin In setup.py you could add
setup(
name='dataverse',
# ...
extras_require={
"testing": TESTS_REQUIRE,
"somethingsomething": THAT_OTHER_THING,
}
# and so on
and then pip install -e ".[testing]"
That type of thing drives me crazy because I can never remember the proper syntax and have to look it up every time. ymmv
also, mind you I am typing this by hand and haven't tested it.
If you've got the repo cloned locally, the TESTS_REQUIRE
packages can be installed (and the test suite run) by running:
$ python setup.py test
I haven't tested this locally, so I'm not sure if setup.py
is configured for that to work correctly, but that's generally the idea of the tests_require
keyword argument in the setup
method.
To get the tests to run I created ~/.virtualenvs/dataverse-client-python/src/dataverse/dataverse/settings/local.py but I'm not sure if this is right.