Modernize python versions

The versions listed in setup.cfg are quite old. Also fix the broken
unit tests and add the appropriate job template.

Depends-on: https://review.opendev.org/c/openstack/project-config/+/909494
Change-Id: Ifca330011b49af8a92bcf222760dd7fe0c873d30
This commit is contained in:
Takashi Kajinami 2024-02-20 10:26:54 +09:00
parent 4c4ae58575
commit 3f37303231
5 changed files with 22 additions and 18 deletions

3
.zuul.yaml Normal file
View File

@ -0,0 +1,3 @@
- project:
templates:
- openstack-python3-jobs

View File

@ -2,3 +2,4 @@ pbr>=1.6 # Apache-2.0
icalendar icalendar
Jinja2>=2.8 # BSD License (3 clause) Jinja2>=2.8 # BSD License (3 clause)
PyYAML>=3.1.0 # MIT PyYAML>=3.1.0 # MIT
extras>=1.0.0 # MIT

View File

@ -1,20 +1,22 @@
[metadata] [metadata]
name = yaml2ical name = yaml2ical
summary = Convert YAML meeting descriptions into iCalendar files summary = Convert YAML meeting descriptions into iCalendar files
description-file = description_file =
README.rst README.rst
author = NDSU IBM Capstone Group & OpenStack Infrastructure Team author = NDSU IBM Capstone Group & OpenStack Infrastructure Team
author-email = openstack-infra@lists.openstack.org author_email = openstack-infra@lists.openstack.org
home-page = http://docs.openstack.org/infra/system-config/ home_page = http://docs.openstack.org/infra/system-config/
python_requires = >=3.8
classifier = classifier =
Intended Audience :: Information Technology Intended Audience :: Information Technology
Intended Audience :: System Administrators Intended Audience :: System Administrators
License :: OSI Approved :: Apache Software License License :: OSI Approved :: Apache Software License
Operating System :: POSIX :: Linux Operating System :: POSIX :: Linux
Programming Language :: Python Programming Language :: Python
Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
[global] [global]
setup-hooks = setup-hooks =

View File

@ -1,24 +1,22 @@
[tox] [tox]
minversion = 1.6 minversion = 1.6
envlist = py37,py36,py35,pep8 envlist = py3,pep8
ignore_basepython_conflict = True
[testenv] [testenv]
install_command = pip install -U {opts} {packages} basepython = python3
deps = -r{toxinidir}/requirements.txt deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands = python setup.py testr --slowest --testr-args='{posargs}' commands = python setup.py testr --slowest --testr-args='{posargs}'
usedevelop = true usedevelop = true
[testenv:pep8] [testenv:pep8]
basepython = python3
commands = flake8 commands = flake8
[testenv:venv] [testenv:venv]
basepython = python3
commands = {posargs} commands = {posargs}
[testenv:mkical] [testenv:mkical]
basepython = python3
commands = yaml2ical -y meetings/ -i icals/ -f commands = yaml2ical -y meetings/ -i icals/ -f
[flake8] [flake8]

View File

@ -183,23 +183,23 @@ class MeetingTestCase(unittest.TestCase):
summary = 'OpenStack Subteam 8 Meeting' summary = 'OpenStack Subteam 8 Meeting'
patterns = [] patterns = []
# The "main" meeting should have an exdate # The "main" meeting should have an exdate
patterns.append(re.compile(r'.*exdate:\s*20150810T120000', re.I)) patterns.append(re.compile(r'exdate:20150810T120000Z', re.I))
# The "main" meeting should start on 2015-08-13 # The "main" meeting should start on 2015-08-13
patterns.append(re.compile(r'.*dtstart;.*:20150803T120000Z', re.I)) patterns.append(re.compile(r'dtstart:20150803T120000Z', re.I))
# The "main" meeting should have a simple summary # The "main" meeting should have a simple summary
patterns.append(re.compile(r'.*summary:\s*%s' % summary, re.I)) patterns.append(re.compile(r'summary:%s' % summary, re.I))
# The "skipped" meeting should start on 20150806 # The "skipped" meeting should start on 20150806
patterns.append(re.compile(r'.*dtstart;.*:20150810T120000Z', re.I)) patterns.append(re.compile(r'dtstart:20150810T120000Z', re.I))
# The "skipped" meeting should say include 'CANCELLED' and the datetime # The "skipped" meeting should say include 'CANCELLED' and the datetime
patterns.append(re.compile(r'.*summary:\s*CANCELLED.*20150810T120000Z', patterns.append(re.compile(r'summary:CANCELLED.*20150810T120000Z',
re.I)) re.I))
m = meeting.load_meetings(meeting_yaml)[0] m = meeting.load_meetings(meeting_yaml)[0]
cal = ical.Yaml2IcalCalendar() cal = ical.Yaml2IcalCalendar()
cal.add_meeting(m) cal.add_meeting(m)
cal_str = str(cal.to_ical()) cal_str = cal.to_ical().decode('utf-8')
self.assertTrue(hasattr(m.schedules[0], 'skip_dates')) self.assertTrue(hasattr(m.schedules[0], 'skip_dates'))
for p in patterns: for p in patterns:
self.assertNotEqual(None, p.match(cal_str)) self.assertIsNotNone(p.search(cal_str))
def test_adhoc_meeting(self): def test_adhoc_meeting(self):
meeting_yaml = sample_data.ADHOC_MEETING meeting_yaml = sample_data.ADHOC_MEETING