Skip to content

Commit 67f6888

Browse files
committed
Update GitHub actions, add PyPy 3.9 to test matrix
1 parent 5023c1e commit 67f6888

File tree

6 files changed

+26
-10
lines changed

6 files changed

+26
-10
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v3
1111

1212
- name: Set up Python 3.9
13-
uses: actions/setup-python@v2
13+
uses: actions/setup-python@v4
1414
with:
1515
python-version: 3.9
1616

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v3
1414

1515
- name: Set up Python 3.9
16-
uses: actions/setup-python@v2
16+
uses: actions/setup-python@v4
1717
with:
1818
python-version: 3.9
1919

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ jobs:
88

99
strategy:
1010
matrix:
11-
python: ['3.7', '3.8', '3.9', '3.10', 'pypy3']
11+
python: ['3.7', '3.8', '3.9', '3.10', 'pypy3.9']
1212

1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515

1616
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v2
17+
uses: actions/setup-python@v4
1818
with:
1919
python-version: ${{ matrix.python-version }}
2020

src/graphql/pyutils/is_iterable.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1+
from array import array
12
from typing import Any, ByteString, Collection, Iterable, Mapping, Text, ValuesView
23

34

45
__all__ = ["is_collection", "is_iterable"]
56

6-
collection_types: Any = Collection
7+
collection_types: Any = [Collection]
78
if not isinstance({}.values(), Collection): # Python < 3.7.2
8-
collection_types = (Collection, ValuesView)
9+
collection_types.append(ValuesView)
10+
if not isinstance(array, Collection): # PyPy issue 3820
11+
collection_types.append(array)
12+
collection_types = (
13+
collection_types[0] if len(collection_types) == 1 else tuple(collection_types)
14+
)
915
iterable_types: Any = Iterable
1016
not_iterable_types: Any = (ByteString, Mapping, Text)
1117

tests/execution/test_map_async_iterator.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import platform
12
import sys
23
from asyncio import CancelledError, Event, ensure_future, sleep
34

@@ -6,6 +7,8 @@
67
from graphql.execution import MapAsyncIterator
78

89

10+
is_pypy = platform.python_implementation() == "PyPy"
11+
912
try: # pragma: no cover
1013
anext
1114
except NameError: # pragma: no cover (Python < 3.10)
@@ -344,6 +347,10 @@ def double(x):
344347
with raises(StopAsyncIteration):
345348
await anext(doubles)
346349

350+
# no more exceptions should be thrown
351+
if is_pypy:
352+
# need to investigate why this is needed with PyPy
353+
await doubles.aclose() # pragma: no cover
347354
await doubles.athrow(RuntimeError("no more ouch"))
348355

349356
with raises(StopAsyncIteration):

tox.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
[tox]
2-
envlist = py3{7,8,9,10}, black, flake8, isort, mypy, docs
2+
envlist = py3{7,8,9,10}, pypy39, black, flake8, isort, mypy, docs
33
isolated_build = true
44

55
[gh-actions]
66
python =
7+
3: py39
78
3.7: py37
89
3.8: py38
910
3.9: py39
1011
3.10: py310
12+
pypy3: pypy39
13+
pypy3.9: pypy39
1114

1215
[testenv:black]
1316
basepython = python3.9

0 commit comments

Comments
 (0)