-
-
Notifications
You must be signed in to change notification settings - Fork 155
Fix test_console failure finding pipdeptree in other environments #351
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
Fix test_console failure finding pipdeptree in other environments #351
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this, if someone's has another pipdeptree on an earlier path we'd wrongfully accept it.
Since it looks like this test exists to ensure that our d = distribution("pipdeptree")
our_entry_points = d.entry_points
assert len(our_entry_points) == 1
pipdeptree_entry_point = our_entry_points[0]
pipdeptree_module = pipdeptree_entry_point.load()
return_code = pipdeptree_module()
assert return_code == 0 The |
4307c4a
to
31ffbe7
Compare
17c6317
to
abb9863
Compare
Emm, sorry, I retry this test in packaging, but looks failed also?
|
That's weird. It's able to find pipdeptree's metadata but can't find its console scripts? Can you provide the steps you ran before running the test |
I think I figure it out....
But it only has a METADATA under it.
When we run pytest, current directory is added to |
I am not sure why they do this, but it looks affect our testcases. |
I download their src.rpm(here), uncompress it, replace the sources with our new code and then rpmbuild -ba ~/rpmbuild/SPECS/python-pipdeptree.spec. |
So from reading the Fedora spec dealing with Python packages and this Python spec, it looks like packaging tools aren't required to create an entry_points.txt metadata file if they don't want to. But they must at least generate a METADATA file. I'm not familiar with the packaging process, let alone with Fedora, but this does reflect your outputs since we only see the METADATA file (although the Fedora docs explain that the source and the metadata should be installed in "%{python3_sitelib} or %{python3_sitearch}" rather than within the source directory?). I'm unsure why it is not required for entry_points.txt to be generated when there are console scripts that exist, but because of this testing by using the importlib API here may only work for package installers that do generate entry_points.txt if possible (e.g. pip). |
There looks to be a pytest plugin just for testing console scripts, and from looking at the source it seems that it will either: |
77c2e32
to
0d277d7
Compare
This approach worked and looks solve the problem in packaging! |
When we are using pytest in packaging process, we may not get the `/usr/bin/pipdeptree` as we need. So, let's use `script_runner` to check it. Signed-off-by: cunshunxia <[email protected]>
d3d69a4
to
d45827d
Compare
Will release 2.18.1 after merging this |
When we are using pytest in packaging process, we may not get the
/usr/bin/pipdeptree
as we need. So, let's use thePATH
env to get the binary instead.fix: #348