On 11/10/2017 04:58 AM, Scott Talbert wrote:
I've recently noticed that in some of the python packages I maintain,
there are now additionally byte-compiled files that appear to be from
[swt2c@rawhide-test ~][PROD]$ rpm -ql python3-pytest-xdist | grep PYTEST
It seems that these files must be generated when running the tests for
the package. I have a hunch they might be problematic, though, because
they contain the buildroot's path in them:
[swt2c@rawhide-test ~][PROD]$ strings
| grep builddir
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?
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?
For the record, here are packages that have the issue now:
$ sudo dnf repoquery --releasever 27 -s -f '*PYTEST.pyc'