diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 993247868..7e37b4ad5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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 @@ -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 diff --git a/test/test_viewer.py b/test/test_viewer.py index 20c3d2faa..5633a3bc1 100644 --- a/test/test_viewer.py +++ b/test/test_viewer.py @@ -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: @@ -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 @@ -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) @@ -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) diff --git a/tox.ini b/tox.ini index 6b407dfeb..248a6fd37 100644 --- a/tox.ini +++ b/tox.ini @@ -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