On Fri, 10 Nov 2017, Petr Viktorin wrote:

[swt2c@rawhide-test ~][PROD]$ strings /usr/lib/python3.6/site-packages/xdist/__pycache__/_version.cpython-36-PYTEST.pyc | grep builddir t/builddir/build/BUILDROOT/python-pytest-xdist-1.20.1-1.fc28.noarch/usr/lib/python3.6/site-packages/xdist/_version.py What are these special PYTEST byte compiled files?
Pytest compiles test files slightly differently than normal Python. That's what allows it to do its "assert rewriting", i.e. telling you what went wrong assert. I *assume* this is what's happening here: they started caching the results of that compilation. I might be wrong, but that's the direction I would look in if I had time to research this issue today :)

I'm adding Thomas, pytest's maintainer, to the thread. Thomas, do you know more about what's happening?

Yes, that does appear to be what's happening:
https://github.com/pytest-dev/pytest/blob/master/_pytest/assertion/rewrite.py

Should they be packaged in the first place?

I don't think they should.
They're cache files; nothing should break if they're if not present. Pytest will probably try to write them when it runs, but should silently do nothing if it can't write into /usr/lib. So, the only time not packaging them would be a problem is if someone runs the tests as root, as that would create unpackaged files in /usr/lib. But I don't think that's a use case we need to support.



Anyway, thanks for letting us know! This might turn out to be something we'll need to solve at the Python SIG level.
I'll start with a brainstorm.

How to best make sure those files aren't packaged? %ignore? Or rm them at end of %check? Or is there some Pytest config option or env variable to prevent writing them, which we could enable in the rpm macros?

I ended up setting PYTHONDONTWRITEBYTECODE=1 when calling py.test as a workaround for now.

For the record, here are packages that have the issue now:

$ sudo dnf repoquery --releasever 27 -s -f '*PYTEST.pyc'
pytest-3.2.1-3.fc27.src.rpm
python-astropy-2.0.2-1.fc27.src.rpm
python-camel-0.1.2-2.fc27.src.rpm
python-flask-0.11.1-6.fc27.src.rpm
python-healpy-1.11.0-1.fc27.src.rpm
python-joblib-0.11-1.fc27.src.rpm
python-pyqtgraph-0.10.0-1.fc27.src.rpm
python-pytest-timeout-1.2.0-3.fc27.src.rpm
python-pytest-xdist-1.18.2-1.fc27.src.rpm
python-wcsaxes-0.9-5.fc26.src.rpm

It seems like there really should be more packages affected.

Scott
_______________________________________________
python-devel mailing list -- python-devel@lists.fedoraproject.org
To unsubscribe send an email to python-devel-le...@lists.fedoraproject.org

Reply via email to