Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest-runner shouldn't be in setup_requires #26

Open
yurivict opened this issue Sep 16, 2017 · 8 comments
Open

pytest-runner shouldn't be in setup_requires #26

yurivict opened this issue Sep 16, 2017 · 8 comments

Comments

@yurivict
Copy link

This makes something needed only for testing be required unconditionally. Should pytest-runner be under tests_require?

@felipedau
Copy link
Contributor

@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?

@yurivict
Copy link
Author

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.

@yurivict
Copy link
Author

I only have py27-pytest-3.2.1 installed, and it is sufficient to run tests. Is pytest-runner even needed?

@felipedau
Copy link
Contributor

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?

@yurivict
Copy link
Author

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

@yurivict
Copy link
Author

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.

@felipedau
Copy link
Contributor

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?

@yurivict
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants