Skip to content

Commit 8be4098

Browse files
authored
Add python 3.10 support, fix test regression for win/python3.8 (#92)
* Fix asyncio.TimeoutError not being handled correctly with win/python3.8 * Add python 3.10 to the test matrix and setup.py * Do not use pip cache-dir in test workflow * Remove unused dependencies (#79)
1 parent eb79869 commit 8be4098

File tree

6 files changed

+26
-16
lines changed

6 files changed

+26
-16
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
os: [ubuntu-20.04, windows-latest]
13-
python: ["3.6", "3.7", "3.8", "3.9"]
13+
python: ["3.6", "3.7", "3.8", "3.9", "3.10"]
1414
qt:
1515
- package: PyQt5
1616
qt_api: "pyqt5"
@@ -42,7 +42,7 @@ jobs:
4242
- name: Install dependencies
4343
run: |
4444
pipenv install --python ${{ matrix.python }} --dev
45-
pipenv run --python ${{ matrix.python }} pip install ${{ matrix.qt.package }} pytest
45+
pipenv run --python ${{ matrix.python }} pip install --no-cache-dir ${{ matrix.qt.package }} pytest
4646
4747
- name: Install Libxcb dependencies
4848
if: matrix.os == 'ubuntu-20.04'

.pre-commit-config.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
repos:
2-
# Black formats the Python code.
3-
- repo: https://github.com/psf/black
4-
rev: 23.3.0
2+
- repo: https://github.com/psf/black
3+
rev: 23.9.1
54
hooks:
65
- id: black
7-
language_version: python3
6+
language_version: python3

Pipfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ name = "pypi"
44
verify_ssl = true
55

66
[dev-packages]
7-
atomicwrites = "*"
87
pytest = "*"
9-
pytest-forked = "*"
108
pytest-raises = "*"
119

1210
[packages]

setup.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,25 @@
1818
("Sam McCormack", "Gerard Marull-Paretas", "Mark Harviston", "Arve Knudsen")
1919
),
2020
packages=["qasync"],
21-
python_requires="~=3.6",
21+
python_requires=">=3.6,<4.0",
2222
license="BSD",
2323
description="Implementation of the PEP 3156 Event-Loop with Qt.",
2424
long_description=long_description,
2525
long_description_content_type="text/markdown",
2626
keywords=["Qt", "asyncio"],
2727
classifiers=[
2828
"Development Status :: 4 - Beta",
29-
"License :: OSI Approved :: BSD License",
29+
"Environment :: X11 Applications :: Qt",
3030
"Intended Audience :: Developers",
31-
"Operating System :: Microsoft :: Windows",
31+
"License :: OSI Approved :: BSD License",
3232
"Operating System :: MacOS :: MacOS X",
33+
"Operating System :: Microsoft :: Windows",
3334
"Operating System :: POSIX",
35+
"Programming Language :: Python :: 3",
3436
"Programming Language :: Python :: 3.6",
3537
"Programming Language :: Python :: 3.7",
3638
"Programming Language :: Python :: 3.8",
3739
"Programming Language :: Python :: 3.9",
38-
"Programming Language :: Python :: 3 :: Only",
39-
"Environment :: X11 Applications :: Qt",
40+
"Programming Language :: Python :: 3.10",
4041
],
4142
)

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
logging.basicConfig(
12-
level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(name)s - %(message)s"
12+
level=logging.DEBUG, format="%(levelname)s\t%(filename)s:%(lineno)s %(message)s"
1313
)
1414

1515

tests/test_qeventloop.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,8 @@ def cb3():
589589

590590
loop._add_reader(c_sock.fileno(), cb1)
591591

592-
asyncio.ensure_future(client_coro())
593-
asyncio.ensure_future(server_coro())
592+
clent_task = asyncio.ensure_future(client_coro())
593+
server_task = asyncio.ensure_future(server_coro())
594594

595595
both_done = asyncio.gather(client_done, server_done)
596596
loop.run_until_complete(asyncio.wait_for(both_done, timeout=1.0))
@@ -786,3 +786,15 @@ async def mycoro():
786786
assert not loop.is_running()
787787
loop.run_until_complete(mycoro())
788788
assert not loop.is_running()
789+
790+
791+
def teardown_module(module):
792+
"""
793+
Remove handlers from all loggers
794+
See: https://github.com/pytest-dev/pytest/issues/5502
795+
"""
796+
loggers = [logging.getLogger()] + list(logging.Logger.manager.loggerDict.values())
797+
for logger in loggers:
798+
handlers = getattr(logger, "handlers", [])
799+
for handler in handlers:
800+
logger.removeHandler(handler)

0 commit comments

Comments
 (0)