Dear python-devel,
I'm playing with packaging of my little project[1] and I'm a bit puzzled about the following issue.
When I go into git repo of my project and run unittests directly:
~~~ cd ~/projects/pylatest python2 setup.py test python3 setup.py test ~~~
Or via tox (which is configured to run both python2.7 and python3.4), it all works fine and both python2 and python3 test runs reports success.
I have the following section in my specfile[3], which executes the tests during the build (this is suggested by Packaging:Python guidelines):
~~~ %check %{__python2} setup.py test %{__python3} setup.py test ~~~
But when the tests are executed via rpmbuild, python2 test run reports a pass, while python3 run fails[2]. This happens both on my local machine and in copr.
At this point it's clear that I'm doing something wrong and would need to inspect and fix this failure in pylatest, but I'm concerned about something else in this email:
1) How come that running tests directly gives different outcome compared to test run executed during rpm build? Note that this seems not to be caused by different python version as it also happens on my local machine (so python version is the same).
2) Is this an expected behaviour? What do I miss then? If not, is this interesting enough to check this issue deeper?
[1] https://github.com/marbu/pylatest [2] https://copr-be.cloud.fedoraproject.org/results/marbu/pylatest-fedora/fedora... [3] https://github.com/marbu/specfiles/blob/1911be24ff130bf7d614694de5ae340b8888...
----- Original Message -----
From: "Martin Bukatovic" martin.bukatovic@gmail.com To: python-devel@lists.fedoraproject.org Sent: Monday, February 22, 2016 12:04:56 AM Subject: my project's python3 unit tests passes, but fails during rpmbuild
Dear python-devel,
I'm playing with packaging of my little project[1] and I'm a bit puzzled about the following issue.
When I go into git repo of my project and run unittests directly:
cd ~/projects/pylatest python2 setup.py test python3 setup.py test
Or via tox (which is configured to run both python2.7 and python3.4), it all works fine and both python2 and python3 test runs reports success.
I have the following section in my specfile[3], which executes the tests during the build (this is suggested by Packaging:Python guidelines):
%check %{__python2} setup.py test %{__python3} setup.py test
But when the tests are executed via rpmbuild, python2 test run reports a pass, while python3 run fails[2]. This happens both on my local machine and in copr.
Hi Martin,
can you try to run your tests with following variables defined LANG=en_GB.utf8 LC_ALL=en_GB.utf8?
Python3 uses locale.getpreferredencoding when no encoding is specified when opening a file which may be an ascii on some systems.
At this point it's clear that I'm doing something wrong and would need to inspect and fix this failure in pylatest, but I'm concerned about something else in this email:
- How come that running tests directly gives different outcome compared to
test run executed during rpm build? Note that this seems not to be caused by different python version as it also happens on my local machine (so python version is the same).
- Is this an expected behaviour? What do I miss then? If not, is this
interesting enough to check this issue deeper?
[1] https://github.com/marbu/pylatest [2] https://copr-be.cloud.fedoraproject.org/results/marbu/pylatest-fedora/fedora... [3] https://github.com/marbu/specfiles/blob/1911be24ff130bf7d614694de5ae340b8888...
-- Martin Bukatovic _______________________________________________ python-devel mailing list python-devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/python-devel@lists.fedoraproject....
-- Robert Kuska {rkuska}
Hi Robert,
On Mon, Feb 22, 2016 at 03:25:48AM -0500, Robert Kuska wrote:
But when the tests are executed via rpmbuild, python2 test run reports a pass, while python3 run fails[2]. This happens both on my local machine and in copr.
can you try to run your tests with following variables defined LANG=en_GB.utf8 LC_ALL=en_GB.utf8?
Python3 uses locale.getpreferredencoding when no encoding is specified when opening a file which may be an ascii on some systems.
Thanks for the hint. You are right, I can reproduce the issue by running:
LC_ALL=C python3 setup.py test
So yeah, the problem is in my unit test code which reads utf8 files.
On 22 February 2016 at 18:25, Robert Kuska rkuska@redhat.com wrote:
----- Original Message -----
From: "Martin Bukatovic" martin.bukatovic@gmail.com To: python-devel@lists.fedoraproject.org Sent: Monday, February 22, 2016 12:04:56 AM Subject: my project's python3 unit tests passes, but fails during
rpmbuild
Dear python-devel,
I'm playing with packaging of my little project[1] and I'm a bit puzzled about the following issue.
When I go into git repo of my project and run unittests directly:
cd ~/projects/pylatest python2 setup.py test python3 setup.py test
Or via tox (which is configured to run both python2.7 and python3.4), it
all
works fine and both python2 and python3 test runs reports success.
I have the following section in my specfile[3], which executes the tests during the build (this is suggested by Packaging:Python guidelines):
%check %{__python2} setup.py test %{__python3} setup.py test
But when the tests are executed via rpmbuild, python2 test run reports a pass, while python3 run fails[2]. This happens both on my local machine
and
in copr.
Hi Martin,
can you try to run your tests with following variables defined LANG=en_GB.utf8 LC_ALL=en_GB.utf8?
Python3 uses locale.getpreferredencoding when no encoding is specified when opening a file which may be an ascii on some systems.
Fedora 24 will be shipping with a C.UTF-8 locale: https://bugzilla.redhat.com/show_bug.cgi?id=902094
Perhaps we should file an RFE with rpm and/or mock to run scriptlets under the C.UTF-8 locale rather than the C locale?
Cheers, Nick.
On Mon, Feb 22, 2016 at 9:15 PM, Nick Coghlan ncoghlan@gmail.com wrote:
Fedora 24 will be shipping with a C.UTF-8 locale: https://bugzilla.redhat.com/show_bug.cgi?id=902094
Perhaps we should file an RFE with rpm and/or mock to run scriptlets under the C.UTF-8 locale rather than the C locale?
This is definitely a good idea. I've observed all kinds of weird things happening with mock and rpm scriptlets lately due to it using the C locale.
On Feb 22, 2016 6:15 PM, "Nick Coghlan" ncoghlan@gmail.com wrote:
On 22 February 2016 at 18:25, Robert Kuska rkuska@redhat.com wrote:
----- Original Message -----
From: "Martin Bukatovic" martin.bukatovic@gmail.com To: python-devel@lists.fedoraproject.org Sent: Monday, February 22, 2016 12:04:56 AM Subject: my project's python3 unit tests passes, but fails during
rpmbuild
Dear python-devel,
I'm playing with packaging of my little project[1] and I'm a bit puzzled about the following issue.
When I go into git repo of my project and run unittests directly:
cd ~/projects/pylatest python2 setup.py test python3 setup.py test
Or via tox (which is configured to run both python2.7 and python3.4),
it all
works fine and both python2 and python3 test runs reports success.
I have the following section in my specfile[3], which executes the
tests
during the build (this is suggested by Packaging:Python guidelines):
%check %{__python2} setup.py test %{__python3} setup.py test
But when the tests are executed via rpmbuild, python2 test run reports
a
pass, while python3 run fails[2]. This happens both on my local
machine and
in copr.
Hi Martin,
can you try to run your tests with following variables defined
LANG=en_GB.utf8
LC_ALL=en_GB.utf8?
Python3 uses locale.getpreferredencoding when no encoding is specified
when opening
a file which may be an ascii on some systems.
Fedora 24 will be shipping with a C.UTF-8 locale:
https://bugzilla.redhat.com/show_bug.cgi?id=902094
Perhaps we should file an RFE with rpm and/or mock to run scriptlets
under the C.UTF-8 locale rather than the C locale?
Yes, that would be a great idea. But Martin, Since it sounds like you're upstream for this package you should also fix the code to run in C (non utf8) locale. C.utf8 isn't available every where so relying on it is non portable. And often times if something fails in C locale it means that there's problems encoding and decoding strings that are hidden when you use a utf8 locale but are present in other circumstances.
-Toshio
On 23 February 2016 at 13:13, Toshio Kuratomi a.badger@gmail.com wrote:
On Feb 22, 2016 6:15 PM, "Nick Coghlan" ncoghlan@gmail.com wrote:
Fedora 24 will be shipping with a C.UTF-8 locale:
https://bugzilla.redhat.com/show_bug.cgi?id=902094
Perhaps we should file an RFE with rpm and/or mock to run scriptlets
under the C.UTF-8 locale rather than the C locale?
Yes, that would be a great idea.
Thinking this through a bit more...
1. AFAIK, the Fedora Cloud images currently still use the C locale rather than C.UTF-8 2. rpm/mock running scriptlets in the C locale thus helps find scriptlets that will fail in the Fedora Cloud image
So perhaps this idea makes more sense as a systemwide change proposal for F25? While it appears on the surface to be a simple tweak, it now seems to me that the ripple effects across environments (including koji) could be fairly significant.
Cheers, Nick.
python-devel@lists.fedoraproject.org