Add py39 support

- update setup.cfg to advertise supported platforms
- fix tox.ini file use version agnostic envlist
- add openstack-tox-py39 job
- minor fix on test file which wrongly assumed that pop
  returns a new dictionary
- added type to release dictionary, which is what would
  have prevented previous item from being introduced.

Change-Id: I60b80ebe41a66d39e6f1a51a3d00c0b9292d42fd
This commit is contained in:
Sorin Sbarnea 2021-03-16 13:24:48 +00:00
parent 4db03f5e1e
commit cc0d019446
9 changed files with 44 additions and 16 deletions

1
conftest.py Normal file
View File

@ -0,0 +1 @@
pytest_plugins = ['pytest_html']

4
pytest.ini Normal file
View File

@ -0,0 +1,4 @@
[pytest]
markers:
hookwrapper
optionalhook

View File

@ -37,6 +37,7 @@ import os
import re
import requests
import yaml
from typing import Dict
# Define releases
RELEASES = [
@ -375,7 +376,9 @@ def shim_convert_old_release_names(releases_names, is_periodic):
return modified_releases_name
def write_releases_dictionary_to_bash(releases_dictionary, bash_file_name):
def write_releases_dictionary_to_bash(
releases_dictionary: Dict[str, str], bash_file_name
):
logger = logging.getLogger('emit-releases')
# Make it deterministic, expected constants in the proper order
try:

View File

@ -1,3 +1,4 @@
import copy
from emit_releases_file import write_releases_dictionary_to_bash
from unittest import mock
@ -13,9 +14,12 @@ else:
BUILTINS_OPEN = "builtins.open"
def test_empty_releases_dictionary_fails():
def test_empty_releases_dictionary_fails(caplog):
assert not write_releases_dictionary_to_bash({}, "")
expected_info = ('emit-releases', 40, 'Writting releases dictionary')
assert expected_info in caplog.record_tuples
@pytest.fixture
def releases_dictionary():
@ -57,7 +61,8 @@ def releases_dictionary():
],
)
def test_missing_key_fails(releases_dictionary, deleted_key):
wrong_releases_dictionary = releases_dictionary.pop(deleted_key)
wrong_releases_dictionary = copy.copy(releases_dictionary)
wrong_releases_dictionary.pop(deleted_key)
assert not write_releases_dictionary_to_bash(wrong_releases_dictionary, "")

View File

@ -249,7 +249,7 @@ def main(args=sys.argv[1:]):
)
results = {}
for review in proj_reviews:
for ts, message in get_jenkins_comment_message(review).iteritems():
for ts, message in get_jenkins_comment_message(review).items():
ci_results = process_jenkins_comment_message(message, job_names)
patchset = str(re.search('Patch Set (.+?):', message).group(1))

View File

@ -13,11 +13,12 @@ classifier =
License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 2.6
Programming Language :: Python :: 3
Programming Language :: Python :: 3.3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
python_requires = >= 3.6
[files]
data_files =
@ -37,7 +38,9 @@ warnerrors = False
[tool:pytest]
norecursedirs = .git .tox dist .eggs
log_cli = true
# do not set log_cli to true by default as it would display misleading
# exception during normal test execution.
# log_cli = true
[flake8]
# based on https://github.com/psf/black

View File

@ -1,7 +1,18 @@
import os
from subprocess import run
import subprocess
import sys
def test_jobs_gerrit():
f = os.path.join(os.path.dirname(__file__), "../scripts/tripleo-jobs-gerrit.py")
result = os.system(f)
assert result == 0
f = os.path.abspath(
os.path.join(os.path.dirname(__file__), "../scripts/tripleo-jobs-gerrit.py")
)
result = run(
[sys.executable, f],
universal_newlines=True,
check=False,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
assert result.returncode == 0, result

View File

@ -1,6 +1,6 @@
[tox]
# keep py3 before py2 to assure they are preffered for envs like linters:
envlist = linters,py{37,36,35,27},molecule
envlist = linters,py,molecule
minversion = 3.4.0
ignore_basepython_conflict = True
skip_missing_interpreters = True

View File

@ -20,7 +20,7 @@
vars:
tox_environment:
PYTEST_REQPASS: 1
- openstack-tox-py36:
- openstack-tox-py36: &tox-py
success-url: "tox/reports.html"
failure-url: "tox/reports.html"
files: &py_files
@ -33,6 +33,7 @@
vars:
tox_environment:
PYTEST_REQPASS: 84
- openstack-tox-py39: *tox-py
- tripleo-ci-centos-8-content-provider:
dependencies:
- openstack-tox-linters
@ -43,5 +44,5 @@
# jobs might be defined and nothing can merge in this repo.
- openstack-tox-linters
- tripleo-tox-molecule
- openstack-tox-py36:
files: *py_files
- openstack-tox-py36: *tox-py
- openstack-tox-py39: *tox-py