Skip to content

Commit

Permalink
Config with pure python template (#7)
Browse files Browse the repository at this point in the history
* Drop support for Python 2.7, 3.5, 3.6.
* Add support for Python 3.11.
  • Loading branch information
Michael Howitz committed Jan 14, 2023
1 parent 94e71a0 commit be2902e
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 49 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/tests.yml
Expand Up @@ -17,32 +17,29 @@ jobs:
fail-fast: false
matrix:
os:
- ubuntu
- ["ubuntu", "ubuntu-20.04"]
config:
# [Python version, tox env]
- ["3.9", "lint"]
- ["2.7", "py27"]
- ["3.5", "py35"]
- ["3.6", "py36"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["pypy-2.7", "pypy"]
- ["3.11", "py311"]
- ["pypy-3.7", "pypy3"]
- ["3.9", "coverage"]

runs-on: ${{ matrix.os }}-latest
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@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.config[0] }}
- name: Pip cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
Expand All @@ -58,7 +55,7 @@ jobs:
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
pip install coveralls coverage-python-version
pip install coveralls
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .meta.toml
Expand Up @@ -2,14 +2,14 @@
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template = "pure-python"
commit-id = "ee0a2ad7b6d4ce76a898131869cac3578202d80c"
commit-id = "4f0f7596"

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

[coverage]
fail-under = 100
Expand Down
8 changes: 5 additions & 3 deletions CHANGES.rst
Expand Up @@ -2,10 +2,12 @@
CHANGES
=======

4.1.1 (unreleased)
------------------
5.0 (unreleased)
----------------

- Add support for Python 3.11.

- Nothing changed yet.
- Drop support for Python 2.7, 3.5, 3.6.


4.1.0 (2022-07-13)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
@@ -1,7 +1,7 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[bdist_wheel]
universal = 1
universal = 0

[flake8]
doctests = 1
Expand Down
8 changes: 3 additions & 5 deletions setup.py
Expand Up @@ -23,7 +23,7 @@
from setuptools import setup


version = '4.1.1.dev0'
version = '5.0.dev0'


def read(*rnames):
Expand Down Expand Up @@ -88,15 +88,12 @@ def read(*rnames):
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'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 :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Natural Language :: English',
Expand All @@ -111,6 +108,7 @@ def read(*rnames):
package_dir={'': 'src'},
packages=find_packages('src'),
namespace_packages=['zope', 'zope.app'],
python_requires='>=3.7',
install_requires=[
'setuptools',
'ZODB',
Expand Down
2 changes: 1 addition & 1 deletion src/zope/app/applicationcontrol/browser/runtimeinfo.py
Expand Up @@ -19,7 +19,7 @@
from zope.app.applicationcontrol.interfaces import IRuntimeInfo


class RuntimeInfoView(object):
class RuntimeInfoView:

_fields = (
"ZopeVersion",
Expand Down
2 changes: 1 addition & 1 deletion src/zope/app/applicationcontrol/browser/servercontrol.py
Expand Up @@ -22,7 +22,7 @@
from zope.app.applicationcontrol.interfaces import IServerControl


class ServerControlView(object):
class ServerControlView:

def serverControl(self):
return zope.component.getUtility(IServerControl)
Expand Down
2 changes: 1 addition & 1 deletion src/zope/app/applicationcontrol/browser/tests/__init__.py
Expand Up @@ -14,7 +14,7 @@ class BrowserTestCase(unittest.TestCase):
layer = ApplicationControlLayer

def setUp(self):
super(BrowserTestCase, self).setUp()
super().setUp()
self._testapp = TestApp(self.layer.make_wsgi_app())

def publish(self, path, basic=None, form=None, headers=None):
Expand Down
Expand Up @@ -26,7 +26,7 @@


@implementer(ITranslationDomain)
class TranslationDomainStub(object):
class TranslationDomainStub:

def __init__(self, domain, languages):
self.domain = domain
Expand All @@ -39,8 +39,8 @@ def translate(self, msgid, mapping=None, context=None,

def getCatalogsInfo(self):
template = 'locales/%s/LC_MESSAGES/%s.mo'
return dict([(lang, template % (lang, self.domain))
for lang in self.languages])
return {lang: template % (lang, self.domain)
for lang in self.languages}

def reloadCatalogs(self, fileNames):
self.reloadDone = True
Expand Down
Expand Up @@ -34,9 +34,9 @@ def testDomainOverview(self):
def testReload(self):
response = self.publish('/++etc++process/@@TranslationDomain.html',
basic='globalmgr:globalmgrpw',
form={'language': u'de',
'domain': u'zope',
'RELOAD': u'Reload'})
form={'language': 'de',
'domain': 'zope',
'RELOAD': 'Reload'})
body = response.unicode_normal_body
self.assertIn('Message Catalog for de language in zope domain'
' successfully reloaded.', body)
Expand Down
Expand Up @@ -37,7 +37,7 @@ def test_returns_status(self):
self.assertIs(self, view.update())

def test_invalid_days(self):
class MockRequest(object):
class MockRequest:
def __init__(self, **kwargs):
self.form = kwargs

Expand All @@ -47,22 +47,22 @@ def __init__(self, **kwargs):
PACK=True))

result = view.update()
self.assertEqual([u'Error: Invalid Number'], result)
self.assertEqual(['Error: Invalid Number'], result)

del view.request.form['PACK']
result = view.update()
self.assertEqual([u'Error: Invalid Number'], result)
self.assertEqual(['Error: Invalid Number'], result)

def test_pack_error(self):
from ZODB.POSException import StorageError

class Database(object):
class Database:
def pack(self, days=None):
raise StorageError()

component.provideUtility(Database(), IDatabase)

class MockRequest(object):
class MockRequest:
def __init__(self, **kwargs):
self.form = kwargs

Expand Down
Expand Up @@ -22,7 +22,7 @@
from zope.app.applicationcontrol.i18n import ZopeMessageFactory as _


class TranslationDomainControlView(object):
class TranslationDomainControlView:

def getCatalogsInfo(self):
info = []
Expand Down Expand Up @@ -51,7 +51,7 @@ def reloadCatalogs(self):

status = _('Message Catalog for ${language} language'
' in ${domain} domain successfully reloaded.',
mapping={u'language': language,
u'domain': domain.domain})
mapping={'language': language,
'domain': domain.domain})

return status
2 changes: 1 addition & 1 deletion src/zope/app/applicationcontrol/browser/zodbcontrol.py
Expand Up @@ -31,7 +31,7 @@
pass


class ZODBControlView(object):
class ZODBControlView:

status = None

Expand Down
2 changes: 1 addition & 1 deletion src/zope/app/applicationcontrol/tests/__init__.py
Expand Up @@ -6,7 +6,7 @@


@implementer(IServerControl)
class MockServerControl(object):
class MockServerControl:

did_restart = None
did_shutdown = None
Expand Down
2 changes: 1 addition & 1 deletion src/zope/app/applicationcontrol/zopeversion.py
Expand Up @@ -22,7 +22,7 @@


@implementer(IZopeVersion)
class ZopeVersion(object):
class ZopeVersion:

def __init__(self, path=None):
if path is None:
Expand Down
12 changes: 4 additions & 8 deletions tox.ini
Expand Up @@ -4,14 +4,11 @@
minversion = 3.18
envlist =
lint
py27
py35
py36
py37
py38
py39
py310
pypy
py311
pypy3
coverage

Expand Down Expand Up @@ -42,6 +39,7 @@ deps =

[testenv:isort-apply]
basepython = python3
skip_install = true
commands_pre =
deps =
isort
Expand All @@ -54,16 +52,14 @@ allowlist_externals =
mkdir
deps =
coverage
coverage-python-version
commands =
mkdir -p {toxinidir}/parts/htmlcov
coverage run -m zope.testrunner --test-path=src {posargs:-vc}
coverage html
coverage report -m --fail-under=100
coverage html --ignore-errors
coverage report --ignore-errors --show-missing --fail-under=100

[coverage:run]
branch = True
plugins = coverage_python_version
source = zope.app.applicationcontrol

[coverage:report]
Expand Down

0 comments on commit be2902e

Please sign in to comment.