Skip to content

Test python 3.11 in CI #1302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ jobs:
experimental: [false]
python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.7", "pypy-3.8"]
# Do not test on Python 3.11 pre-releases since wrapt causes problems: https://github.com/GrahamDumpleton/wrapt/issues/196
# include:
include:
# Only test on a single configuration while there are just pre-releases
# - os: ubuntu-latest
# experimental: true
# python-version: "3.11.0-alpha.3"
- os: ubuntu-latest
experimental: true
python-version: "3.11.0-alpha - 3.11.0"
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -44,7 +44,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
Expand Down
15 changes: 8 additions & 7 deletions test/test_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

import can
from can.viewer import CanViewer, parse_args

from test.config import IS_CI

# Allow the curses module to be missing (e.g. on PyPy on Windows)
try:
Expand Down Expand Up @@ -251,9 +251,10 @@ def test_receive(self):
if _id["dt"] == 0:
self.assertEqual(_id["count"], 1)
else:
self.assertTrue(
pytest.approx(_id["dt"], 0.1)
) # dt should be ~0.1 s
if not IS_CI: # do not test timing in CI
assert _id["dt"] == pytest.approx(
0.1, abs=5e-2
) # dt should be ~0.1 s
self.assertEqual(_id["count"], 2)
else:
# Make sure dt is 0
Expand Down Expand Up @@ -347,7 +348,7 @@ def test_pack_unpack(self):

raw_data = self.pack_data(CANOPEN_TPDO2 + 1, data_structs, 12.34, 4.5, 6)
parsed_data = CanViewer.unpack_data(CANOPEN_TPDO2 + 1, data_structs, raw_data)
self.assertTrue(pytest.approx(parsed_data, [12.34, 4.5, 6]))
assert parsed_data == pytest.approx([12.34, 4.5, 6])
self.assertTrue(
isinstance(parsed_data[0], float)
and isinstance(parsed_data[1], float)
Expand All @@ -356,14 +357,14 @@ def test_pack_unpack(self):

raw_data = self.pack_data(CANOPEN_TPDO3 + 1, data_structs, 123.45, 67.89)
parsed_data = CanViewer.unpack_data(CANOPEN_TPDO3 + 1, data_structs, raw_data)
self.assertTrue(pytest.approx(parsed_data, [123.45, 67.89]))
assert parsed_data == pytest.approx([123.45, 67.89])
self.assertTrue(all(isinstance(d, float) for d in parsed_data))

raw_data = self.pack_data(
CANOPEN_TPDO4 + 1, data_structs, math.pi / 2.0, math.pi
)
parsed_data = CanViewer.unpack_data(CANOPEN_TPDO4 + 1, data_structs, raw_data)
self.assertTrue(pytest.approx(parsed_data, [math.pi / 2.0, math.pi]))
assert parsed_data == pytest.approx([math.pi / 2.0, math.pi])
self.assertTrue(all(isinstance(d, float) for d in parsed_data))

raw_data = self.pack_data(CANOPEN_TPDO1 + 2, data_structs)
Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[tox]
isolated_build = true

[testenv]
deps =
pytest==6.2.*,>=6.2.5
pytest==7.1.*,>=7.1.2
pytest-timeout==2.0.2
pytest-cov==3.0.0
coverage==6.2
coverage==6.3
codecov==2.1.12
hypothesis~=6.35.0
pyserial~=3.5
Expand Down