Skip to content

Commit

Permalink
Dependencies: drop support Python 3.6 (#108)
Browse files Browse the repository at this point in the history
In addition, there are a few other fixes to the CI

 * Add limit `pytest-asyncio<0.17` since the latest release breaks the
   unit tests.
 * Update `pytest-notebook>=0.7` which includes a fix that was breaking
   the unit tests.
 * Remove the use of `async_generator` which was only needed as a 
   backport fix for Python 3.5

Co-authored-by: Chris Sewell <chrisj_sewell@hotmail.com>
  • Loading branch information
muhrin and chrisjsewell authored Jan 17, 2022
1 parent cfc0498 commit c35668d
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9]
rabbitmq: [latest]
include:
- python-version: 3.8
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:

- name: Upload coverage to Codecov
if: github.repository == 'aiidateam/kiwipy'
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
name: kiwipy
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def run_apidoc(app):

autodoc_default_options = {
# these all derive from concurrent.futures, whose docstrings are in the wrong format
'exclude-members': 'CancelledError,wait,as_completed,Future'
'exclude-members': 'CancelledError,wait,as_completed,Future,TimeoutError'
}


Expand Down
2 changes: 1 addition & 1 deletion kiwipy/communications.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def broadcast_send(self, body, sender=None, subject=None, correlation_id=None) -

class CommunicatorHelper(Communicator):
# Have to disable this linter because this class remains abstract and it is
# just used by calsses that will themselves be concrete
# just used by classes that will themselves be concrete
# pylint: disable=abstract-method

def __init__(self):
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
],
keywords='communication messaging rpc broadcast',
install_requires=['shortuuid', 'async_generator', 'pytray>=0.2.2, <0.4.0', 'deprecation'],
python_requires='>=3.6.2',
python_requires='>=3.7',
extras_require={
'docs': [
'docutils==0.14',
Expand All @@ -43,10 +43,11 @@
'rmq': ['aio-pika', 'pyyaml~=5.1'],
'tests': [
'coverage',
'ipykernel',
'pytest-cov',
'pytest~=5.4',
'pytest-asyncio~=0.12',
'pytest-notebook',
'pytest-asyncio~=0.12,<0.17',
'pytest-notebook>=0.7',
'pytest-benchmark',
'pika',
'msgpack',
Expand Down
7 changes: 2 additions & 5 deletions test/rmq/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

try:
import aio_pika
from async_generator import yield_, async_generator

# pylint: disable=redefined-outer-name

Expand All @@ -19,17 +18,15 @@ def connection_params() -> dict:
return {'url': os.environ.get(ENV_KIWI_RMQ_URI, DEFAULT_RMQ_URI)}

@pytest.fixture
@async_generator
async def connection(connection_params: dict):
conn = await aio_pika.connect_robust(**connection_params)
await yield_(conn)
yield conn
await conn.close()

@pytest.fixture
@async_generator
async def communicator(connection_params):
communicator = await utils.new_communicator(connection_params)
await yield_(communicator)
yield communicator
await communicator.disconnect()

except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion test/rmq/test_rmq_thread_communicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,5 +265,5 @@ def test_jupyter_notebook():
# Express the path in a way that will work no matter where the tests are being ran and convert
# to str as py35 doesn't support Paths being passed to open()
my_dir = pathlib.Path(__file__).parent
with open(str(my_dir / pathlib.Path('notebooks/communicator.ipynb'))) as handle:
with open(my_dir / pathlib.Path('notebooks/communicator.ipynb')) as handle:
fixture.check(handle)
7 changes: 2 additions & 5 deletions test/rmq/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
try:
import asyncio

from async_generator import yield_, async_generator
import aio_pika
import aio_pika.exceptions
from kiwipy import rmq
import kiwipy.rmq

@pytest.fixture
@async_generator
async def task_publisher(connection: aio_pika.Connection):
exchange_name = f'{__file__}.{uuid.uuid4()}'
task_queue_name = f'{__file__}.{uuid.uuid4()}'
Expand All @@ -27,11 +25,10 @@ async def task_publisher(connection: aio_pika.Connection):
connection, queue_name=task_queue_name, exchange_name=exchange_name, testing_mode=True
)
await task_pub.connect()
await yield_(task_pub)
yield task_pub
await task_pub.disconnect()

@pytest.fixture
@async_generator
async def task_queue(connection: aio_pika.Connection):
exchange_name = f'{__file__}.{uuid.uuid4()}'
task_queue_name = f'{__file__}.{uuid.uuid4()}'
Expand All @@ -40,7 +37,7 @@ async def task_queue(connection: aio_pika.Connection):
connection, queue_name=task_queue_name, exchange_name=exchange_name, testing_mode=True
)
await task_pub.connect()
await yield_(task_pub)
yield task_pub
await task_pub.disconnect()

except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ envlist = py37
[testenv]
usedevelop = true

[testenv:py{36,37,38,39}]
[testenv:py{37,38,39}]
description = Run the unit tests
extras =
rmq
Expand Down

0 comments on commit c35668d

Please sign in to comment.