Bug 2152171 - "pytest" script runs tests without user's personal libraries
Summary: "pytest" script runs tests without user's personal libraries
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: pytest
Version: 37
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Miro Hrončok
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-12-09 15:05 UTC by Nadav Har'El
Modified: 2022-12-16 01:56 UTC (History)
8 users (show)

Fixed In Version: pytest-7.2.0-2.fc38 pytest-7.1.3-2.fc37
Clone Of:
Environment:
Last Closed: 2022-12-16 01:56:44 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Nadav Har'El 2022-12-09 15:05:08 UTC
Since Fedora 37, the "pytest" script runs Python with the "-s" option. As a result, the test code can only use official Python packages installed via RPM, and doesn't see the user's locally installed packages with pip and so on.
This is wrong - pytest is supposed to run the user's Python code, and use whatever libraries the user chose to install.

The Fedora Python packaging guidelines at https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/ explain that "-s" was added to Python shebangs for a reason: it explains that the "-s" "ensures the user’s Python packages (e.g. installed by pip install --user, or just placed in the current directory) don’t interfere with the RPM installed software.". However, the document immediately comments that "Sometimes, such content is desirable, such as with plugins.". This is exactly the case here in pytest: pytest is designed to run the user's Python code (the tests themselves), and it is very natural that the user will also want to use libraries that they installed themselves and not an official part of the system.

Comment 1 Orion Poplawski 2022-12-09 23:03:30 UTC
Fix component.  python3-pytest is EPEL-only (but bugzilla doesn't know that).

Comment 3 Fedora Update System 2022-12-12 08:44:21 UTC
FEDORA-2022-f8e5d427e7 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2022-f8e5d427e7

Comment 4 Fedora Update System 2022-12-12 08:45:54 UTC
FEDORA-2022-f8e5d427e7 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 5 Fedora Update System 2022-12-12 08:53:20 UTC
FEDORA-2022-a174e00184 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-a174e00184

Comment 6 Fedora Update System 2022-12-13 01:32:26 UTC
FEDORA-2022-a174e00184 has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-a174e00184`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-a174e00184

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2022-12-16 01:56:44 UTC
FEDORA-2022-a174e00184 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.