test_function fails: Error: invalid command 'pytest'
Problem
After removing the before_script
for the test_function
job (which builds a conda environment from environment.yml
), the job fails with the above error message.
Reason
Apparently, the tests_require
section in setup.cfg
is only used by the test
command from setuptools
, which we override by using:
[aliases]
test = pytest
pytest
, however, does not use the tests_require
section and even if it would, I don't think it would work, because it isn't even installed at the time it is called with python setup.py test
(which effectively means python setup.py pytest
). pytest
would need to be installed before having a chance to look at tests_require
which then would tell it to install itself
See here for more info.
Solution?
For now, my only solution is to install the tests_require
dependencies via the conda environment (i.e. remove the line before_script: []
again).
I would leave the tests_require
section in, even though it is not used atm for documentation purposes and maybe for a future fix.