From eee316ce7bf55b24d05c1fb87f9f67f24e5534d5 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 17 Aug 2018 10:16:37 +1000 Subject: [PATCH] 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 --- doc/source/deprecation.rst | 12 ++++++++++++ roles/__init__.py | 0 roles/htmlify-logs/__init__.py | 0 roles/multi-node-known-hosts/__init__.py | 0 roles/sphinx/__init__.py | 0 roles/tox/__init__.py | 0 roles/upload-afs/__init__.py | 0 roles/upload-logs-swift/__init__.py | 0 roles/validate-host/__init__.py | 0 tox.ini | 3 +++ 10 files changed, 15 insertions(+) create mode 100644 roles/__init__.py create mode 100644 roles/htmlify-logs/__init__.py create mode 100644 roles/multi-node-known-hosts/__init__.py create mode 100644 roles/sphinx/__init__.py create mode 100644 roles/tox/__init__.py create mode 100644 roles/upload-afs/__init__.py create mode 100644 roles/upload-logs-swift/__init__.py create mode 100644 roles/validate-host/__init__.py diff --git a/doc/source/deprecation.rst b/doc/source/deprecation.rst index 6d3fff3c1..aab28b74d 100644 --- a/doc/source/deprecation.rst +++ b/doc/source/deprecation.rst @@ -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 +`__. + .. _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 diff --git a/roles/__init__.py b/roles/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/roles/htmlify-logs/__init__.py b/roles/htmlify-logs/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/roles/multi-node-known-hosts/__init__.py b/roles/multi-node-known-hosts/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/roles/sphinx/__init__.py b/roles/sphinx/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/roles/tox/__init__.py b/roles/tox/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/roles/upload-afs/__init__.py b/roles/upload-afs/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/roles/upload-logs-swift/__init__.py b/roles/upload-logs-swift/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/roles/validate-host/__init__.py b/roles/validate-host/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tox.ini b/tox.ini index bcb350d48..cf27ff9d1 100644 --- a/tox.ini +++ b/tox.ini @@ -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