Bug 2152171

Summary: "pytest" script runs tests without user's personal libraries
Product: [Fedora] Fedora Reporter: Nadav Har'El <nadav>
Component: pytestAssignee: Miro Hrončok <mhroncok>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 37CC: dradez, mhroncok, mrunge, orion, pviktori, python-packagers-sig, thomas.moschny, TicoTimo
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pytest-7.2.0-2.fc38 pytest-7.1.3-2.fc37 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-12-16 01:56:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.