Skip to content

Commit

Permalink
Merge pull request #87 from musicinmybrain/SocketError
Browse files Browse the repository at this point in the history
Fix issues with Python 3.2 ResourceWarning workaround
  • Loading branch information
dataflake authored Dec 6, 2022
2 parents 6af55f2 + b7bace5 commit 7cded08
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
os:
- ubuntu
- ["ubuntu", "ubuntu-20.04"]
config:
# [Python version, tox env]
- ["3.9", "lint"]
Expand All @@ -28,22 +28,23 @@ jobs:
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["pypy-2.7", "pypy"]
- ["pypy-3.7", "pypy3"]
- ["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:
- 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 Down
3 changes: 2 additions & 1 deletion .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template = "pure-python"
commit-id = "b4cfc9ca6065ca82646fa69d04ee4c15c58035e1"
commit-id = "180c99ed3def7da6e173a5a496cad6484eadd044"

[python]
with-windows = false
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
3.6.1 (unreleased)
==================

- Add support for Python 3.11.

- Drop support for Python 3.4.


Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
5 changes: 0 additions & 5 deletions src/ZConfig/components/logger/tests/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("<eventlog>\n"
" <syslog>\n"
" level error\n"
Expand All @@ -350,10 +349,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.SocketError: # pragma: no cover
pass

def test_with_http_logger_localhost(self):
logger = self.check_simple_logger("<eventlog>\n"
Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ envlist =
py38
py39
py310
py311
pypy
pypy3
docs
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7cded08

Please sign in to comment.