From d40e4ccf01f25ca9b158cedd6aeca1adfa864479 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 3 Dec 2022 09:07:38 -0500 Subject: [PATCH 1/5] socket.error, not socket.SocketError --- src/ZConfig/components/logger/tests/test_logger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ZConfig/components/logger/tests/test_logger.py b/src/ZConfig/components/logger/tests/test_logger.py index e69a938..dff608f 100644 --- a/src/ZConfig/components/logger/tests/test_logger.py +++ b/src/ZConfig/components/logger/tests/test_logger.py @@ -352,7 +352,7 @@ def test_with_syslog(self): syslog.close() # avoid ResourceWarning try: syslog.socket.close() # ResourceWarning under 3.2 - except socket.SocketError: # pragma: no cover + except socket.error: # pragma: no cover pass def test_with_http_logger_localhost(self): From 6a9f579883635011890fafc7805e9c95ec8fe022 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 3 Dec 2022 09:20:23 -0500 Subject: [PATCH 2/5] Drop the Python 3.2 ResourceWarning workaround Python 3.2 is long since end-of-life, and the workaround produces an unhandled exception on Python 3.11: AttributeError: NoneType object has no attribute close --- src/ZConfig/components/logger/tests/test_logger.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/ZConfig/components/logger/tests/test_logger.py b/src/ZConfig/components/logger/tests/test_logger.py index dff608f..ddab786 100644 --- a/src/ZConfig/components/logger/tests/test_logger.py +++ b/src/ZConfig/components/logger/tests/test_logger.py @@ -350,10 +350,6 @@ def test_with_syslog(self): self.assertEqual(syslog.level, logging.ERROR) self.assertTrue(isinstance(syslog, loghandler.SysLogHandler)) syslog.close() # avoid ResourceWarning - try: - syslog.socket.close() # ResourceWarning under 3.2 - except socket.error: # pragma: no cover - pass def test_with_http_logger_localhost(self): logger = self.check_simple_logger("\n" From 79d32160361de56d162be3c7e8abd50502db78b3 Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Mon, 5 Dec 2022 16:36:53 +0100 Subject: [PATCH 3/5] - update GitHub Actions configuration to exercise the error --- .github/workflows/tests.yml | 7 ++++--- .meta.toml | 3 ++- CHANGES.rst | 2 ++ setup.py | 1 + tox.ini | 5 +++-- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f9f622d..3c40fa5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,6 +28,7 @@ jobs: - ["3.8", "py38"] - ["3.9", "py39"] - ["3.10", "py310"] + - ["3.11", "py311"] - ["pypy-2.7", "pypy"] - ["pypy-3.7", "pypy3"] - ["3.9", "docs"] @@ -37,13 +38,13 @@ jobs: 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') }} diff --git a/.meta.toml b/.meta.toml index 7c856a2..0a304f5 100644 --- a/.meta.toml +++ b/.meta.toml @@ -2,7 +2,7 @@ # https://github.com/zopefoundation/meta/tree/master/config/pure-python [meta] template = "pure-python" -commit-id = "b4cfc9ca6065ca82646fa69d04ee4c15c58035e1" +commit-id = "d8ee00613a60c98a8d2227b0564403d0e447741a" [python] with-windows = false @@ -11,6 +11,7 @@ with-future-python = false with-legacy-python = true with-docs = true with-sphinx-doctests = false +with-macos = false [tox] use-flake8 = true diff --git a/CHANGES.rst b/CHANGES.rst index 32eb7ee..af2e2bb 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,8 @@ 3.6.1 (unreleased) ================== +- Add support for Python 3.11. + - Drop support for Python 3.4. diff --git a/setup.py b/setup.py index a6b3311..d093342 100644 --- a/setup.py +++ b/setup.py @@ -70,6 +70,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', 'Operating System :: OS Independent', diff --git a/tox.ini b/tox.ini index 5340e7f..2c24d04 100644 --- a/tox.ini +++ b/tox.ini @@ -11,6 +11,7 @@ envlist = py38 py39 py310 + py311 pypy pypy3 docs @@ -66,8 +67,8 @@ deps = commands = mkdir -p {toxinidir}/parts/htmlcov coverage run -m zope.testrunner --test-path=src {posargs:-vc} - coverage html - coverage report -m --fail-under=95 + coverage html --ignore-errors + coverage report --ignore-errors --show-missing --fail-under=95 [coverage:run] branch = True From 5f0199151f0bf4dca234151b9874ee3e70c827b9 Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Tue, 6 Dec 2022 10:38:14 +0100 Subject: [PATCH 4/5] - work around GHA python versions issue --- .github/workflows/tests.yml | 4 ++-- .meta.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3c40fa5..cedf24b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: os: - - ubuntu + - ["ubuntu", "ubuntu-20.04"] config: # [Python version, tox env] - ["3.9", "lint"] @@ -34,7 +34,7 @@ jobs: - ["3.9", "docs"] - ["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: diff --git a/.meta.toml b/.meta.toml index 0a304f5..f26e062 100644 --- a/.meta.toml +++ b/.meta.toml @@ -2,7 +2,7 @@ # https://github.com/zopefoundation/meta/tree/master/config/pure-python [meta] template = "pure-python" -commit-id = "d8ee00613a60c98a8d2227b0564403d0e447741a" +commit-id = "180c99ed3def7da6e173a5a496cad6484eadd044" [python] with-windows = false From b7bace5c81c5a7a910e722b0d6dfe96522f599b6 Mon Sep 17 00:00:00 2001 From: Jens Vagelpohl Date: Tue, 6 Dec 2022 10:41:55 +0100 Subject: [PATCH 5/5] - please linter --- src/ZConfig/components/logger/tests/test_logger.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ZConfig/components/logger/tests/test_logger.py b/src/ZConfig/components/logger/tests/test_logger.py index ddab786..6168da2 100644 --- a/src/ZConfig/components/logger/tests/test_logger.py +++ b/src/ZConfig/components/logger/tests/test_logger.py @@ -339,7 +339,6 @@ def test_custom_formatter(self): self.assertTrue(sio.getvalue().find("Don't panic") >= 0) def test_with_syslog(self): - import socket logger = self.check_simple_logger("\n" " \n" " level error\n"