Reputation: 76672
ruamel.yaml
has a regression, introduced with a merged PR, that changed code that has essentially different paths for Python versions compiled with wide and narrow Unicode characters.
The regression was not found during the pre-build/commit testing, because the tests, that are executed with tox
were never run on a Python with narrow ('--enable-unicode=ucs2') Unicode characters. My 2.7.X is being compiled with `--enable-unicode=ucs4' and in Python 3.4+ strings have dynamic Unicode width, acting as if they are 4 byte wide for the code involved.
I have compiled a narrow version of 2.7.15. How can I test the narrow version along with the other Python versions (in particular the wide 2.7) in one tox
run, so that when one or more of the Python versions fail, no new version is committed, and no packages are pushed to PyPI?
I tried adding a target py27m
to the interpreter list used by tox-globinterpreter
:
p python2.7m /opt/python/2.7.15m/bin/python
and ran:
tox -r -e py27m
but that did not work, as that used Python 3.6.6 to run the test (which is the interpeter tox
is executed with).
"Overloading" Python 2.6 in the interpreter list to use the narrow 2.7:
p python2.6 /opt/python/2.7.15m/bin/python
didn't work either.
Upvotes: 0
Views: 337
Reputation: 76672
That you cannot overload the interpreter list, probably has to do with dropped support for 2.6 (target Python3.3
and using tox -e py33
e.g. doesn't work either). But it is relatively easy to add a specific target for py27m
in your tox.ini
:
[tox]
toxworkdir = /data2/DATA/tox/ruamel.yaml
envlist = py36,py27,py35,py34,pypy,py27m
[testenv]
commands =
python -c "import sys, sysconfig; print('%s ucs-%s' % (sys.version.replace('\n', ' '), sysconfig.get_config_var('Py_UNICODE_SIZE'), ))"
/bin/bash -c 'pytest _test/test_*.py'
deps =
pytest
[testenv:py27m]
basepython = /opt/python/2.7.15m/bin/python
The python -c ...
command is to have some extra feedback on the python version installed, in particular the character width, in each of the virtualenv
enviroments tox
creates, as the default tox
output doesn't include that.
(The entries for running flake8
/ codestyle
in the actual tox.ini
were removed for clarity).
Together with a interpreter list (~/.config/tox/interpreters.lst
):
v 1
# Original pattern used:
g /opt/python/?.?/bin/python?.? /opt/python/pypy2/bin/pypy
# Interpreters found:
p python3.6 /opt/python/3.6/bin/python3.6
p python3.4 /opt/python/3.4/bin/python3.4
p python2.7 /opt/python/2.7/bin/python2.7
p python3.5 /opt/python/3.5/bin/python3.5
p python3.7 /opt/python/3.7/bin/python3.7
p pypy /opt/python/pypy2/bin/pypy
e
, running tox -e
now results in:
.
.
.
2.7.15 (default, Jun 30 2018, 23:05:50) [GCC 7.3.0] ucs-4
py27m runtests: commands[1] | /bin/bash -c pytest _test/test_*.py
============================= test session starts =============================
platform linux2 -- Python 2.7.15, pytest-3.6.2, py-1.5.4, pluggy-0.6.0
.
.
.
2.7.15 (default, Jul 1 2018, 11:43:51) [GCC 7.3.0] ucs-2
py27m runtests: commands[1] | /bin/bash -c pytest _test/test_*.py
============================= test session starts ==============================
platform linux2 -- Python 2.7.15, pytest-3.6.2, py-1.5.4, pluggy-0.6.0
.
.
.
============= 320 passed, 1 skipped, 7 xfailed in 32.36 seconds ===============
___________________________________ summary ____________________________________
py36: commands succeeded
py27: commands succeeded
py35: commands succeeded
py34: commands succeeded
pypy: commands succeeded
py27m: commands succeeded
congratulations :)
This way code paths that differ for the same Python version compiled with narrow and wide Unicode can be tested in one go.
Upvotes: 1