pytest-runner shouldn't be in setup_requires
yurivict opened this issue · 8 comments
This makes something needed only for testing be required unconditionally. Should pytest-runner
be under tests_require
?
@yurivict that is what pytest's docs instructs. It is said that:
... [pytest-runner] is a standalone version of pytest no prior installation whatsoever is required for calling the test command.
From its description:
Invoke py.test as distutils command with dependency resolution
I agree it seems wrong. It looks like a hack to integrate pytest to setuptools, but maybe the best option they found?
So, yeah, it will always be downloaded but the bright side is that it is a really small package and setup_requires
does not install the package. I just tested on a virtual environment and neither python setup.py install
nor python setup.py test
leave pytest-runner
or pytest
installed.
Is it a problem for the port you made?
Is it a problem for the port you made?
Actually, yes. It fails to build unless pytest-runner
is pre-installed. Anything used only for testing shouldn't be made a dependency of the port. On FreeBSD, the port building framework finds all such problems, which is a good thing.
I only have py27-pytest-3.2.1 installed, and it is sufficient to run tests. Is pytest-runner
even needed?
It is needed unless you already have pytest installed.
For example, removing pytest-runner
(or moving it to tests_require
) will not run the tests on an environment that does not have pytest:
$ python setup.py test
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'pytest'
pytest-runner
creates a pytest
entry point and that is what's called when you do not have pytest pre-installed.
Maybe it could be removed from setup_requires
and mention that if you really need to run the tests, you must install pytest first?
pytest belongs to py27-pytest-3.2.1
$ pkg which /usr/local/bin/pytest
/usr/local/bin/pytest was installed by package py27-pytest-3.2.1
Maybe just leave it as it is. I patched out pytest-runner
on the FreeBSD, and it runs fine now. There is no such command or package.
pytest belongs to py27-pytest-3.2.1
What I am saying is that I think pytest-runner
will shadow pytest
during the setup. From its setup.py
:
entry_points={
'distutils.commands': [
'ptr = ptr:PyTest',
'pytest = ptr:PyTest',
],
},
Unexpectedly, I could not get python setup.py test
to run on a Debian jessie after removing pytest-runner
from the setup - and pytest was installed.
Maybe just leave it as it is. I patched out pytest-runner on the FreeBSD, and it runs fine now. There is no such command or package.
Will that be a PITA whenever you need to update it? I assume that might be a problem if one day we package pyaxo for Debian as well, so I will take a look at pytest's issues and see if they are working on this.
@rxcomm, what do you think?
What I am saying is that I think pytest-runner will shadow pytest during the setup. From its setup.py:
I see.
I do have the pytest-runner package available (devel/py-pytest-runner), but tests run fine with or without it installed.