-
Notifications
You must be signed in to change notification settings - Fork 12
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
namespace_packages make tests fail #27
Comments
Just to be sure I'm understanding what you're after here:
Is that right? Presumably because of the way the packaging system is orchestrating things. Do you have an example of another python package that does use namespaces_packages that installs correctly and has passing tests in this package build scenario? |
Yes, and also it seems more correct to test against what’s actually installed, not against something in the build directory (just to the build log: those environmental variables
Unfortunately not. Just to say, that namespace packages seem to be wee complicated and there are many caveats in https://packaging.python.org/guides/packaging-namespace-packages/ . |
Yeah, totally understand that namespace packages are complicated and messy. But paste.deploy by virtue of its name and history (long before I came along) simply is one, not much we can do about it. Unless you're able to come up with an example that we can crib from, then I'm not sure what to do. Is it possible to move the testing to test the source? That's how the testing is done for the python side of the packaging. Other members of the team may have additional comments or ideas. |
In your steps there, is the source folder still on the This is a big reason why the recommended source layout is to put the code into a |
Add |
In Python 3 a namespace package does not need an $ python3 -m venv env
$ env/bin/pip install -e .
$ env/bin/python setup.py sdist
$ rm -rf env *.egg-info
$ python3 -m venv env
$ env/bin/pip install dist/PasteDeploy-2.1.0.tar.gz
$ env/bin/pip install pytest
$ env/bin/pytest
<snip>
26 passed, 1 skipped in 0.23s |
I am perfectly aware of namespace packages, and I haven’t said that touching |
How have we used namespace packages incorrectly? Please do not use language that turns things into personal attacks or I will close and lock the issue. I provided steps showing that things work fine and have been unable to reproduce your errors. If you can provide more exact steps then maybe I can help but otherwise nothing has been demonstrated to be broken in pastedeploy. |
??? I have no idea how you could see a personal attack in what I so far hoped be completely technical discussion. And to your question: I have no idea, I haven’t claimed I have ever created Python package with namespaces. Do we agree that you are installing in the manner which cannot be tested, because simple import from your package fails? Perhaps, you don't care, and it is somehow all right (I don't see it, but as I said I am not the biggest master of namespaces). |
I'm simply a maintainer of PasteDeploy (a decade old library that I'm helping use for the last year or so), it is not mine, and accusing me of using namespaces incorrectly is not constructive, nor is it correct as I keep asking for help reproducing the issue to show it's actually broken. We aren't using it incorrectly until we can actually reproduce a bug. I felt the language was unnecessarily aggressive / accusatory.
Well I do care about the issue, it's why I'm here trying to help. So far I'm unable to find a scenario in which things aren't working!
What does this mean? At the end of my example commands above that successfully ran the tests on the installed version of the package, I am able to run something like |
https://build.opensuse.org/request/show/816627 by user mcepl + dimstar_suse - Add rm_nspace_pkgs.patch to poorly used namespace_packages (gh#Pylons/pastedeploy#27)
Are you able to run |
That seems to work. Let's try another way:
That seemed to work too. The reason you're getting the reactions you're getting is because we don't understand the problem you're reporting. It is not that we don't want to help. |
Sorry, forgot to try running the tests:
|
Also just to be sure I installed python 3.8 and did the same stuff with it:
I'm relatively certain we're talking past one another; that there is some critical piece of missing information that once we find it we'll all so "ohhhhh" and everything will be fine. But at this point I don't understand. |
I tried to replicate the steps from your build process more directly and I noticed one main difference. You log has:
My equivalent (below) runs bdist_egg before running install_lib and is copying files from the build directory, and doesn't skip the namespace file.
What version of setuptools is running in your environment? |
In some other experimenting I've done it seems like exporting PYTHONPATH sometimes makes a difference. I installed paste.deploy to an arbitrary root and added the path to site-package in that root to PYTHONPATH. |
The reason I'm pressing on this now is because it's been claimed in https://build.opensuse.org/request/show/816627 that we're doing it wrong and "Package uses namespace_packages, when it shouldn't." That's simply not the case: paste.deploy is suppose to work with paste. It is one of the earlier examples of a namespace package. The change to the RPM may break things when both are present. Something else is wrong. I'd like for us to be able to figure it out. |
Wow! THank you, you are really working on this hard. Thank you! The first comment has attached truly complete build log … including all packages installed, so it is
OK, this is strange (I am NOT saying it is your problem) … PYTHONPATH on the same line as pytest works for hundreds of other Python packages in openSUSE distro, but I will try on Monday to modify our macros to try with |
The "patch" here would break any other |
I suspect that #35 will help here. The code is no longer importable from the root of the git repo and so the tests can be run on a different target environment without any path munging. Regardless I'm going to close this until I get some more detail that this is still a problem. As others have noted, removing the namespace_packages metadata would break things and is not going to happen. |
Yeah, #35 seems to help. Thank you. |
Awesome! Thanks for following up @mcepl! |
Bug Report
Describe the bug
With
in
setup()
command insetup.py
, tests fail, because the installation is done incorrectly. When this line is removed all tests pass.To Reproduce
Steps to reproduce the behavior:
pytest -v
command.Actual behavior
All tests error with traceback like:
Expected behavior
Tests pass
Additional context
complete build log
The text was updated successfully, but these errors were encountered: