From f36e7bf45c60e528f4fc3b145fd73e219b0a7d1d Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Tue, 3 Oct 2023 18:54:40 -0700 Subject: [PATCH] Tests: fix pandad setup (#30160) fix panda test old-commit-hash: 7f69f8458ac32a6b790d082d8a4d7e0f102c6a47 --- selfdrive/boardd/tests/test_pandad.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/selfdrive/boardd/tests/test_pandad.py b/selfdrive/boardd/tests/test_pandad.py index b85878e864..c1bf22f146 100755 --- a/selfdrive/boardd/tests/test_pandad.py +++ b/selfdrive/boardd/tests/test_pandad.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 import os import time -import pytest +import unittest import cereal.messaging as messaging from cereal import log @@ -14,10 +14,11 @@ from openpilot.system.hardware.tici.pins import GPIO HERE = os.path.dirname(os.path.realpath(__file__)) -@pytest.mark.skipif(PC, reason="needs a panda") -class TestPandad: +class TestPandad(unittest.TestCase): def setUp(self): + if PC: + raise unittest.SkipTest("needs a panda") # ensure panda is up if len(Panda.list()) == 0: self._run_test(60) @@ -59,7 +60,7 @@ class TestPandad: assert Panda.wait_for_panda(None, 10) if expect_mismatch: - with pytest.raises(PandaProtocolMismatch): + with self.assertRaises(PandaProtocolMismatch): Panda() else: with Panda() as p: @@ -93,8 +94,9 @@ class TestPandad: # should be fast this time self._run_test(8) - @pytest.mark.skipif(HARDWARE.get_device_type() == 'tici', reason="SPI test") def test_protocol_version_check(self): + if HARDWARE.get_device_type() == 'tici': + raise unittest.SkipTest("SPI test") # flash old fw fn = os.path.join(HERE, "bootstub.panda_h7_spiv0.bin") self._flash_bootstub_and_test(fn, expect_mismatch=True) @@ -111,3 +113,7 @@ class TestPandad: self._assert_no_panda() self._run_test(60) + + +if __name__ == "__main__": + unittest.main() \ No newline at end of file