It appears that in at least some situations pytest will create -PYTEST.pyc files, and sometimes (always?) with weird permissions:
-rw-------. 1 root root 1614 Jul 13 2018 /usr/lib64/python3.7/site-packages/cytoolz/__pycache__/utils_test.cpython-37-PYTEST.pyc
I've noticed the following packages have them:
pytest-4.4.1-1.fc31.src.rpm python-astropy-healpix-0.4-1.fc31.src.rpm python-cytoolz-0.9.0.1-3.fc30.src.rpm python-healpy-1.12.9-1.fc31.src.rpm python-pytest-repeat-0.8.0-1.fc31.src.rpm python-pytest-rerunfailures-6.0-1.fc31.src.rpm python-pytest-shutil-1.6.0-2.fc31.src.rpm python-reproject-0.4-6.fc30.src.rpm python3-pytest-asyncio-0.10.0-1.fc31.src.rpm scipy-1.2.1-1.fc31.src.rpm
These can be prevented by setting PYTHONDONTWRITEBYTECODE=1 when run pytest.
Can anyone else shed more light on this? Should we add this to the guidelines? (Possibly not since there do not appear to be many packages like this). I suspect it comes in when has to set PYTHONPATH=%{buildroot}%{python3_sitearch} due to needing to load compiled modules.
- Orion
On 27. 04. 19 5:07, Orion Poplawski wrote:
It appears that in at least some situations pytest will create -PYTEST.pyc files, and sometimes (always?) with weird permissions:
-rw-------. 1 root root 1614 Jul 13 2018 /usr/lib64/python3.7/site-packages/cytoolz/__pycache__/utils_test.cpython-37-PYTEST.pyc
I've noticed the following packages have them:
pytest-4.4.1-1.fc31.src.rpm python-astropy-healpix-0.4-1.fc31.src.rpm python-cytoolz-0.9.0.1-3.fc30.src.rpm python-healpy-1.12.9-1.fc31.src.rpm python-pytest-repeat-0.8.0-1.fc31.src.rpm python-pytest-rerunfailures-6.0-1.fc31.src.rpm python-pytest-shutil-1.6.0-2.fc31.src.rpm python-reproject-0.4-6.fc30.src.rpm python3-pytest-asyncio-0.10.0-1.fc31.src.rpm scipy-1.2.1-1.fc31.src.rpm
These can be prevented by setting PYTHONDONTWRITEBYTECODE=1 when run pytest.
Can anyone else shed more light on this? Should we add this to the guidelines? (Possibly not since there do not appear to be many packages like this). I suspect it comes in when has to set PYTHONPATH=%{buildroot}%{python3_sitearch} due to needing to load compiled modules.
Also, the path must include **test** for this to happen.
utils_test in your example.
pytest_repeat.cpython-37-PYTEST.pyc -> py**test** in here
Or:
astropy_healpix/__pycache__/conftest.cpython-37-PYTEST.pyc astropy_healpix/tests/__pycache__/test_bench.cpython-37-PYTEST.pyc astropy_healpix/tests/__pycache__/test_core.cpython-37-PYTEST.pyc astropy_healpix/tests/__pycache__/test_healpy.cpython-37-PYTEST.pyc astropy_healpix/tests/__pycache__/test_high_level.cpython-37-PYTEST.pyc
I don't think we need explicit guidelines for those. rpmlint should notify you about the permissions, so you will be notified.
If you really want, I can add this to Python Appendix, but I doubt it would make a difference.
On Fri, 26 Apr 2019, Orion Poplawski wrote:
It appears that in at least some situations pytest will create -PYTEST.pyc files, and sometimes (always?) with weird permissions:
-rw-------. 1 root root 1614 Jul 13 2018 /usr/lib64/python3.7/site-packages/cytoolz/__pycache__/utils_test.cpython-37-PYTEST.pyc
I've noticed the following packages have them:
pytest-4.4.1-1.fc31.src.rpm python-astropy-healpix-0.4-1.fc31.src.rpm python-cytoolz-0.9.0.1-3.fc30.src.rpm python-healpy-1.12.9-1.fc31.src.rpm python-pytest-repeat-0.8.0-1.fc31.src.rpm python-pytest-rerunfailures-6.0-1.fc31.src.rpm python-pytest-shutil-1.6.0-2.fc31.src.rpm python-reproject-0.4-6.fc30.src.rpm python3-pytest-asyncio-0.10.0-1.fc31.src.rpm scipy-1.2.1-1.fc31.src.rpm
These can be prevented by setting PYTHONDONTWRITEBYTECODE=1 when run pytest.
Can anyone else shed more light on this? Should we add this to the guidelines? (Possibly not since there do not appear to be many packages like this). I suspect it comes in when has to set PYTHONPATH=%{buildroot}%{python3_sitearch} due to needing to load compiled modules.
I usually just run tests with PYTHONDONTWRITEBYTECODE=1 to prevent pytest from creating its bytecode files as I don't want them to be packaged and it seems a bit easier than deleting them all after the fact.
Scott
python-devel@lists.fedoraproject.org