Cleanup py27 support

Removes and/or replaces all mentions of py27.

Cleans up obsolete requirements and their lower-constraints.

Separates test-requirements.

Makes lower-constraints pass outside of CI (MarkupSafe).

Adds FIXMEs about some hacky Mocks that may misbehave.

Change-Id: Ifc090bf3c1db17d8542ee591c91e8225a597bfe2
This commit is contained in:
Radosław Piliszek 2020-04-17 17:30:28 +02:00
parent b1db4f5c3b
commit 234272eb64
9 changed files with 34 additions and 44 deletions

View File

@ -28,11 +28,11 @@ so the only package you install is ``tox`` itself:
For more information, see `the unit testing section of the Testing wiki page
<https://wiki.openstack.org/wiki/Testing#Unit_Tests>`_. For example:
To run the Python 2.7 tests:
To run the Python 3.7 tests:
.. code-block:: console
tox -e py27
tox -e py37
To run the style tests:
@ -44,7 +44,7 @@ To run multiple tests separate items by commas:
.. code-block:: console
tox -e py27,py37,pep8
tox -e py37,pep8
Running a subset of tests
-------------------------
@ -58,28 +58,28 @@ directory use:
.. code-block:: console
tox -e py27 kolla-ansible.tests
tox -e py37 kolla-ansible.tests
To run the tests of a specific file
``kolla-ansible/tests/test_kolla_docker.py``:
.. code-block:: console
tox -e py27 test_kolla_docker
tox -e py37 test_kolla_docker
To run the tests in the ``ModuleArgsTest`` class in
the ``kolla-ansible/tests/test_kolla_docker.py`` file:
.. code-block:: console
tox -e py27 test_kolla_docker.ModuleArgsTest
tox -e py37 test_kolla_docker.ModuleArgsTest
To run the ``ModuleArgsTest.test_module_args`` test method in
the ``kolla-ansible/tests/test_kolla_docker.py`` file:
.. code-block:: console
tox -e py27 test_kolla_docker.ModuleArgsTest.test_module_args
tox -e py37 test_kolla_docker.ModuleArgsTest.test_module_args
Debugging unit tests
--------------------

View File

@ -35,7 +35,7 @@ jsonpointer==2.0
jsonschema==2.6.0
keystoneauth1==3.4.0
linecache2==1.0.0
MarkupSafe==1.0
MarkupSafe==1.1.0
monotonic==1.4
mox3==0.25.0
msgpack==0.5.6
@ -73,7 +73,6 @@ requests==2.18.4
requestsexceptions==1.4.0
restructuredtext-lint==1.1.3
rfc3986==1.2.0
setuptools==21.0.0
simplejson==3.13.2
six==1.10.0
smmap2==2.0.3

View File

@ -1,13 +1,17 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
pbr!=2.1.0,>=2.0.0 # Apache-2.0
docker>=2.4.2 # Apache-2.0
Jinja2>=2.10 # BSD License (3 clause)
# ini parsing
oslo.config>=5.2.0 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,!=36.2.0,>=21.0.0 # PSF/ZPL
# YAML parsing
PyYAML>=3.12 # MIT
netaddr>=0.7.18 # BSD
# password generation
cryptography>=2.1 # BSD/Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
# templating
Jinja2>=2.10 # BSD License (3 clause)
# Ansible's json_query
jmespath>=0.9.3 # MIT

View File

@ -6,6 +6,7 @@ description-file =
author = OpenStack
author-email = openstack-discuss@lists.openstack.org
home-page = https://docs.openstack.org/kolla-ansible/latest/
python-requires = >=3.6
license = Apache License, Version 2.0
classifier =
Environment :: OpenStack
@ -14,6 +15,8 @@ classifier =
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
@ -41,8 +44,3 @@ scripts =
console_scripts =
kolla-genpwd = kolla_ansible.cmd.genpwd:main
kolla-mergepwd = kolla_ansible.cmd.mergepwd:main
[build_releasenotes]
all_files = 1
build-dir = releasenotes/build
source-dir = releasenotes/source

View File

@ -13,17 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup(
setup_requires=['pbr>=2.0.0'],
pbr=True)

View File

@ -1,18 +1,13 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
# linting
bandit>=1.1.0 # Apache-2.0
bashate>=0.5.1 # Apache-2.0
beautifulsoup4>=4.6.0 # MIT
coverage!=4.4,>=4.0 # Apache-2.0
doc8>=0.6.0 # Apache-2.0
extras>=1.0.0 # MIT
hacking>=3.0,<3.1.0 # Apache-2.0
oslo.log>=3.36.0 # Apache-2.0
# coverage testing
coverage!=4.4,>=4.0 # Apache-2.0
# unit testing
docker>=2.4.2 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0
PrettyTable<0.8,>=0.7.1 # BSD
PyYAML>=3.12 # MIT
pytz>=2013.6 # MIT
stestr>=2.0.0 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=2.2.0 # MIT

View File

@ -26,6 +26,8 @@ from docker.types import Ulimit
from oslotest import base
this_dir = os.path.dirname(sys.modules[__name__].__file__)
# FIXME(yoctozepto): this modifies global interpreter state and affects tests
# from other files
sys.modules['ansible'] = mock.MagicMock()
sys.modules['ansible.module_utils'] = mock.MagicMock()
sys.modules['ansible.module_utils.basic'] = mock.MagicMock()

View File

@ -26,6 +26,8 @@ PROJECT_DIR = os.path.abspath(os.path.join(os. path.dirname(__file__), '../'))
MERGE_CONFIG_FILE = os.path.join(PROJECT_DIR,
'ansible/action_plugins/merge_configs.py')
# FIXME(yoctozepto): this modifies global interpreter state and affects tests
# from other files
sys.modules['ansible.plugins'] = mock.MagicMock()
merge_configs = imp.load_source('merge_configs', MERGE_CONFIG_FILE)

View File

@ -9,7 +9,6 @@ basepython = python3
usedevelop=True
whitelist_externals = find
rm
install_command = pip install {opts} {packages}
deps = -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt