-
-
Notifications
You must be signed in to change notification settings - Fork 528
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
Integration with setup.py test
should not require virtualenv
to be installed
#330
Comments
Original comment by @bittner Looks like for some reason the |
Can a maintainer comment on this issue? Is this known as a bug? |
@bittner currently tox does not expect to be part of a easy-install temporary installation (multi version installed eggs enabled only for the current python session) the |
That obviates the whole point of invoking the tests from setup.py. If that's true, the docs shouldn't suggest using that setuptools command at all and should just recommend invoking Although I have a fix for this issue in pypa/setuptools#794, the fix creates a new issue: If the package under test depends on any of the packages under the What's a little surprising is that I would expect PYTHONPATH should still be set and that would satisfy the test run, but it doesn't. I'll see if I can discover why that is. |
Exactly. 👍 Just to give some motivation: For me, one point of having this working is to obsolete the Why? Because developers love to make their job easy. They will "just make it work", install the full set of requirements. And then we'll have it again. "No. Not possible. That works on my machine!" |
So here's where tox cleans the env when running the tests. But when dependencies are installed, the PYTHONPATH is present, so pip won't install any overlapping dependencies and they'll be missing when running tests. |
@jaraco Re "the docs shouldn't suggest using that setuptools command": My guess is that part of the documentation was written by @hpk42, and I feel he's a fan of making things straightforward. Pragmatic. @RonnyPfannschmidt and @The-Compiler, you seem to partly agree with his ideas, but not to a degree a common user of tox and py.test would expect, correct? No offence, seriously. I'm drawing my conclusions from a few observations in a few conversations. I'm interested to see where this topic leads us to. I'm really a big fan of "there must be a better way". |
The "better way", if I may be so bold, is to use rwt, which may become pip run:
However, I think it will fall prey to the same issue I'm working on in my last couple of comments. |
… invoking tests. Ref tox-dev#330.
With the patch above and the (yet unreleased setuptools 27.3.0), tox will now run the CherryPy tests via @hpk42, @RonnyPfannschmidt: Can you think of any reason tox shouldn't exclude PYTHONPATH when invoking the installer? |
@jaraco Re Arrgh, and then there is this |
@bittner: Yes, good point. I had originally typed |
@jaraco i agree that the setup.py integration is not good i'm not a fan of |
Let's agree on that whatever we do on this repository is to enhance the feature set and fix the documentation of Tox. In other words,
Current StateAs it stands, the Tox documentation promotes an integration with setuptools (in a very specific way). The intended result of this integration is that Unfortunately, this integration doesn't manage to install the How Fix This?
Are there any other alternatives? Short-term, at least? |
I'd very much like to see the integration work as intended. It's not just this mode (setup.py invocation) but also any tool that makes packages available on PYTHONPATH (which rwt does and which Setuptools and pytest runner now also do) when invoking tox will encounter this issue. |
v28.1.0 ------- * #803: Bump certifi to 2016.9.26. v28.0.0 ------- * #733: Do not search excluded directories for packages. This introduced a backwards incompatible change in ``find_packages()`` so that ``find_packages(exclude=['foo']) == []``, excluding subpackages of ``foo``. Previously, ``find_packages(exclude=['foo']) == ['foo.bar']``, even though the parent ``foo`` package was excluded. * #795: Bump certifi. * #719: Suppress decoding errors and instead log a warning when metadata cannot be decoded. v27.3.1 ------- * #790: In MSVC monkeypatching, explicitly patch each function by name in the target module instead of inferring the module from the function's ``__module__``. Improves compatibility with other packages that might have previously patched distutils functions (i.e. NumPy). v27.3.0 ------- * #794: In test command, add installed eggs to PYTHONPATH when invoking tests so that subprocesses will also have the dependencies available. Fixes `tox 330 <https://github.com/tox-dev/tox/issues/330>`_. * #795: Update vendored pyparsing 2.1.9.
Yes, please! As a distro packager (Nix/NixOS) this is very annoying. We package packages for multiple interpreter versions, and during the build process we automatically run tests as well (by default using Granted, our distro is a bit different than others. But as @RonnyPfannschmidt pointed out, an invocation of I think this should also be communicated clearly: |
On Oct 05, 2016, at 04:01 AM, Frederik Rietdijk wrote:
+1 |
v28.1.0 ------- * #803: Bump certifi to 2016.9.26. v28.0.0 ------- * #733: Do not search excluded directories for packages. This introduced a backwards incompatible change in ``find_packages()`` so that ``find_packages(exclude=['foo']) == []``, excluding subpackages of ``foo``. Previously, ``find_packages(exclude=['foo']) == ['foo.bar']``, even though the parent ``foo`` package was excluded. * #795: Bump certifi. * #719: Suppress decoding errors and instead log a warning when metadata cannot be decoded. v27.3.1 ------- * #790: In MSVC monkeypatching, explicitly patch each function by name in the target module instead of inferring the module from the function's ``__module__``. Improves compatibility with other packages that might have previously patched distutils functions (i.e. NumPy). v27.3.0 ------- * #794: In test command, add installed eggs to PYTHONPATH when invoking tests so that subprocesses will also have the dependencies available. Fixes `tox 330 <https://github.com/tox-dev/tox/issues/330>`_. * #795: Update vendored pyparsing 2.1.9.
just to be clear, in the tox docs we now don't recommend anymore to integrate tox with |
Removes the custom Python path explicitly set in the tox configuration file. This should resolve situations [1] where pip may not install required packages (and dependencies) into target virtualenv since they are already provided in PYTHONPATH (see also [2]). [1]: #45 [2]: tox-dev/tox#330 Signed-off-by: James Knight <james.d.knight@live.com>
In my Python projects I want to separate the requirements only needed for testing cleanly from the actual project.
The beautiful thing of tox is I can specify all those additional requirements in the tox configuration (tox.ini), and with the integration in setup.py it's possible to not even have tox installed to execute tests.
Actually, this is the theory, because unfortunately, running tests with
python setup.py test
still requires one dependency to be installed beforehand:virtualenv
Current Behavior
When I run
pip install virtualenv
the same testrun runs like a charm.Is this a problem of tox, or an issue of setuptools?
Expected Behavior
After having set up tox with setuptools integration
it should be possible to run
python setup.py test
to execute tests driven by toxwithout having had to install any requirements (such as
virtualenv
ortox
) manually beforehand.References
This problem is also documented in issue #245.
The text was updated successfully, but these errors were encountered: