Enable Python 2.7 unit tests

Add a testenv:py27 environment that overrides basepython to 2.7

Unfortunately implicit namespace packages are a Python3 thing [1] so
we have to scatter a few __init__.py's around for the test loader
under python2 to be able to find the unit test directories.

Update documenation to mention this

Needed-By: https://review.openstack.org/592768

[1] https://www.python.org/dev/peps/pep-0420/

Change-Id: I9a653666e8a083fb7f3fbb92589fe0467a41e6e6
This commit is contained in:
Ian Wienand 2018-08-17 10:16:37 +10:00
parent 37e12ce9f5
commit eee316ce7b
10 changed files with 15 additions and 0 deletions

View File

@ -32,6 +32,18 @@ Before deprecating a feature in Zuul which is used by `zuul-jobs`, the
usage of the feature must be removed from `zuul-jobs` according to the
deprecation policy described above.
Python Version Policy
=====================
``zuul-jobs`` targets Python 2.7 onwards and Python 3.5 onwards (note
this differs slightly from Ansible upstream, where the policy is 2.6
onwards unless libraries depend on newer features. `zuul-jobs` does
not support Python 2.6).
Library code should be written to be compatible with both. There are
some tips on this in `Ansible and Python 3
<https://docs.ansible.com/ansible/2.5/dev_guide/developing_python_3.html>`__.
.. _zuul-announce: http://lists.zuul-ci.org/cgi-bin/mailman/listinfo/zuul-announce
.. _zuul-discuss: http://lists.zuul-ci.org/cgi-bin/mailman/listinfo/zuul-discuss

0
roles/__init__.py Normal file
View File

View File

View File

0
roles/sphinx/__init__.py Normal file
View File

0
roles/tox/__init__.py Normal file
View File

View File

View File

View File

View File

@ -10,6 +10,9 @@ deps = -r{toxinidir}/test-requirements.txt
commands = stestr run {posargs}
stestr slowest
[testenv:py27]
basepython = python2.7
[testenv:bindep]
# Do not install any requirements. We want this to be fast and work even if
# system dependencies are missing, since it's used to tell you what system