8000 ci: Update to pypy-3.7 and add Python 3.10 on Ubuntu & MacOS (#1143) · hardbyte/python-can@352b1f1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 352b1f1

Browse files
authored
ci: Update to pypy-3.7 and add Python 3.10 on Ubuntu & MacOS (#1143)
* ci: Change pypy3 to pypy-3.7 PyPy 3.6 is no longer available on the macos-latest (macOS-11) image, see actions/runner-images#4060 * ci: Use release version Python 3.10, run syntax checks under 3.10 * listener: Fix PyPy 3.7 error passing a timeout parameter together with block=False * test: Ignore Hypothesis float generation issue with Windows+PyPy-3.7 Hypothesis throws a "Flaky" error for inconsistent data on PyPy-3.7 + Windows only, when generating timestamp fields. I think this is a bug in either Hypothesis or PyPy, but I don't know which.
1 parent 71580d8 commit 352b1f1

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@ jobs:
1313
matrix:
1414
os: [ubuntu-latest, macos-latest, windows-latest]
1515
experimental: [false]
16-
python-version: [3.6, 3.7, 3.8, 3.9, pypy3]
16+
python-version: ["3.6", "3.7", "3.8", "3.9", "pypy-3.7"]
1717
include:
18-
- python-version: 3.10.0-beta.4 # Newest: https://github.com/actions/python-versions/blob/main/versions-manifest.json
19-
os: ubuntu-latest
20-
experimental: true
18+
# Skipping Py 3.10 on Windows until windows-curses has a cp310 wheel,
19+
# see https://github.com/zephyrproject-rtos/windows-curses/issues/26
20+
- os: ubuntu-latest
21+
experimental: false
22+
python-version: "3.10"
23+
- os: macos-latest
24+
experimental: false
25+
python-version: "3.10"
2126
fail-fast: false
2227
steps:
2328
- uses: actions/checkout@v2
@@ -41,10 +46,10 @@ jobs:
4146
runs-on: ubuntu-latest
4247
steps:
4348
- uses: actions/checkout@v2
44-
- name: Set up Python 3.9
49+
- name: Set up Python 3.10
4550
uses: actions/setup-python@v2
4651
with:
47-
python-version: 3.9
52+
python-version: "3.10"
4853
- name: Install dependencies
4954
run: |
5055
python -m pip install --upgrade pip

can/listener.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ def get_message(self, timeout: float = 0.5) -> Optional[Message]:
116116
:return: the Message if there is one, or None if there is not.
117117
"""
118118
try:
119-
return self.buffer.get(block=not self.is_stopped, timeout=timeout)
119+
if self.is_stopped:
120+
return self.buffer.get(block=False)
121+
else:
122+
return self.buffer.get(block=True, timeout=timeout)
120123
except Empty:
121124
return None
122125

test/test_message_class.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99
from datetime import timedelta
1010

1111
from hypothesis import given, settings
12+
import hypothesis.errors
1213
import hypothesis.strategies as st
1314

1415
from can import Message
1516

1617
from .message_helper import ComparingMessagesTestCase
17-
from .config import IS_GITHUB_ACTIONS
18+
from .config import IS_GITHUB_ACTIONS, IS_WINDOWS, IS_PYPY
19+
20+
import pytest
1821

1922

2023
class TestMessageClass(unittest.TestCase):
@@ -42,6 +45,11 @@ class TestMessageClass(unittest.TestCase):
4245
max_examples=2000,
4346
deadline=None if IS_GITHUB_ACTIONS else timedelta(milliseconds=500),
4447
)
48+
@pytest.mark.xfail(
49+
IS_WINDOWS and IS_PYPY,
50+
raises=hypothesis.errors.Flaky,
51+
reason="Hypothesis generates inconistent timestamp floats on Windows+PyPy-3.7",
52+
)
4553
def test_methods(self, **kwargs):
4654
is_valid = not (
4755
(

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ deps =
77
pytest-cov==2.12.*
88
coverage==5.5
99
codecov==2.1.10
10-
hypothesis~=4.56
10+
hypothesis~=6.24.0
1111
pyserial~=3.0
1212
parameterized~=0.8
1313

0 commit comments

Comments
 (0)
0