Skip to content

Commit

Permalink
- Add support for Python 3.12. - Drop support for Python 3.7. (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
icemac authored Jun 12, 2024
1 parent 481ed55 commit 1282024
Show file tree
Hide file tree
Showing 10 changed files with 543 additions and 364 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,29 @@ jobs:
fail-fast: false
matrix:
os:
- ["ubuntu", "ubuntu-20.04"]
- ["ubuntu", "ubuntu-latest"]
config:
# [Python version, tox env]
- ["3.9", "lint"]
- ["3.7", "py37"]
- ["3.11", "release-check"]
- ["3.11", "lint"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.9", "coverage"]
- ["3.12", "py312"]
- ["3.11", "coverage"]

runs-on: ${{ matrix.os[1] }}
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: ${{ matrix.config[1] }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.config[0] }}
- name: Pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
Expand All @@ -50,7 +51,11 @@ jobs:
python -m pip install --upgrade pip
pip install tox
- name: Test
if: ${{ !startsWith(runner.os, 'Mac') }}
run: tox -e ${{ matrix.config[1] }}
- name: Test (macOS)
if: ${{ startsWith(runner.os, 'Mac') }}
run: tox -e ${{ matrix.config[1] }}-universal2
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
Expand Down
3 changes: 2 additions & 1 deletion .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
[meta]
template = "zope-product"
commit-id = "e5c611fb"
commit-id = "b1221c3c"

[python]
with-pypy = false
with-sphinx-doctests = false
with-windows = false
with-future-python = false
with-macos = false
with-docs = false

[coverage]
fail-under = 92
Expand Down
8 changes: 5 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Changelog
=========

3.0.3 (unreleased)
------------------
4.0 (unreleased)
----------------

- Add support for Python 3.12.

- Nothing changed yet.
- Drop support for Python 3.7.


3.0.2 (2024-01-22)
Expand Down
4 changes: 1 addition & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
[bdist_wheel]
universal = 0

[flake8]
doctests = 1
Expand All @@ -17,7 +15,7 @@ ignore =
force_single_line = True
combine_as_imports = True
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
known_third_party = six, docutils, pkg_resources, pytz
known_third_party = docutils, pkg_resources, pytz
known_zope =
known_first_party = Products.PluginIndexes, Products.ZCTextIndex, Products.ZCatalog
default_section = ZOPE
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

setup(
name='Products.GenericSetup',
version='3.0.3.dev0',
version='4.0.dev0',
description='Read Zope configuration state from profile dirs / tarballs',
long_description=README + _BOUNDARY + CHANGES,
classifiers=[
Expand All @@ -33,11 +33,11 @@
"Intended Audience :: Developers",
"License :: OSI Approved :: Zope Public License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development",
"Topic :: System :: Archiving :: Packaging",
Expand All @@ -58,7 +58,7 @@
include_package_data=True,
namespace_packages=['Products'],
zip_safe=False,
python_requires='>=3.7',
python_requires='>=3.8',
install_requires=[
'setuptools',
'Zope >= 4.0b4',
Expand Down
47 changes: 26 additions & 21 deletions src/Products/GenericSetup/tests/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

try:
from five.localsitemanager.registry import PersistentComponents
except ImportError:
except ModuleNotFoundError:
# Avoid generating a spurious dependency
PersistentComponents = None

Expand All @@ -55,7 +55,7 @@ def createComponentRegistry(context):
enableSite(context, iface=IObjectManagerSite)

components = PersistentComponents('++etc++site')
components.__bases__ = (base,)
components.__bases__ = (base, )
components.__parent__ = aq_base(context)
# Make sure calls to getSiteManager on me return myself
# necessary because OFS.ObjectManager.getSiteManager expects _components
Expand Down Expand Up @@ -238,7 +238,6 @@ def getExcludedInterfaces(self):
</componentregistry>
"""


_INTERFACE_COMPONENT = b"""\
<?xml version="1.0" encoding="utf-8"?>
<componentregistry>
Expand All @@ -263,28 +262,32 @@ def _getTargetClass(self):
return ComponentRegistryXMLAdapter

def _populate(self, obj):
obj.registerAdapter(DummyAdapter, required=(None,))
obj.registerAdapter(DummyAdapter, required=(None,), name='foo')
obj.registerAdapter(DummyAdapter, required=(None, ))
obj.registerAdapter(DummyAdapter, required=(None, ), name='foo')

obj.registerSubscriptionAdapter(DummyAdapter,
required=(IAnotherDummy,))
obj.registerHandler(dummy_handler, required=(IAnotherDummy,))
required=(IAnotherDummy, ))
obj.registerHandler(dummy_handler, required=(IAnotherDummy, ))

util = DummyUtility()
name = 'dummy_utility'
util.__name__ = name
util.__parent__ = aq_base(obj)
obj._setObject(name, aq_base(util),
set_owner=False, suppress_events=True)
obj._setObject(name,
aq_base(util),
set_owner=False,
suppress_events=True)
obj.registerUtility(aq_base(obj[name]), IDummyInterface)

util = DummyUtility()
name = ('Products.GenericSetup.tests.test_components.'
'IDummyInterface2-foo')
util.__name__ = name
util.__parent__ = aq_base(obj)
obj._setObject(name, aq_base(util),
set_owner=False, suppress_events=True)
obj._setObject(name,
aq_base(util),
set_owner=False,
suppress_events=True)
obj.registerUtility(aq_base(obj[name]), IDummyInterface2, name='foo')

tool = aq_base(obj.aq_parent['dummy_tool'])
Expand All @@ -303,8 +306,9 @@ def _verifyImport(self, obj):
self.assertTrue(adapted.verify())

dummy = DummyObject()
results = [adap.verify() for adap in
subscribers([dummy], IAnotherDummy2)]
results = [
adap.verify() for adap in subscribers([dummy], IAnotherDummy2)
]
self.assertEqual(results, [True])

dummy = DummyObject()
Expand Down Expand Up @@ -423,8 +427,9 @@ def test_remove_components(self):
self.assertFalse(adapted is None)

dummy = DummyObject()
results = [adap.verify() for adap in
subscribers([dummy], IAnotherDummy2)]
results = [
adap.verify() for adap in subscribers([dummy], IAnotherDummy2)
]
self.assertEqual(results, [])

dummy = DummyObject()
Expand All @@ -450,8 +455,7 @@ def test_remove_components(self):

def test_export_interface_component(self):
sm = self._obj
sm.registerUtility(ITestInterface,
ITestInterfaceType,
sm.registerUtility(ITestInterface, ITestInterfaceType,
"test_interface")
context = DummySetupEnviron()
adapted = getMultiAdapter((sm, context), IBody)
Expand Down Expand Up @@ -502,14 +506,15 @@ class ITestInterfaceType(Interface):


if PersistentComponents is not None:

def test_suite():
# reimport to make sure tests are run from Products
from ..tests.test_components import ComponentRegistryXMLAdapterTests

return unittest.TestSuite((
unittest.defaultTestLoader.loadTestsFromTestCase(
ComponentRegistryXMLAdapterTests),
))
return unittest.TestSuite(
(unittest.defaultTestLoader.loadTestsFromTestCase(
ComponentRegistryXMLAdapterTests), ))
else:

def test_suite():
return unittest.TestSuite()
Loading

0 comments on commit 1282024

Please sign in to comment.