Test files now pytest
Description
Changed test files to use pytest
Verification
Ran pytest on the files
Thanks for contributing to openpilot! In order for us to review your PR as quickly as possible, check the following:
- Convert your PR to a draft unless it's ready to review
- Read the contributing docs
- Before marking as "ready for review", ensure:
- the goal is clearly stated in the description
- all the tests are passing
- the change is something we merge
- include a route or your device' dongle ID if relevant
I recall we had an issue with pytest.skip not skipping earlier, can you make sure that's no longer an issue where you replaced unittest.skip? Perhaps that was because we just ran with unittest
Looks like there's still a bunch of unittest references:
batman:twopilot$ rg unittest selfdrive/
selfdrive/updated/tests/test_base.py
9:import unittest
10:from unittest import mock
58: raise unittest.SkipTest
selfdrive/thermald/tests/test_fan_controller.py
2:from unittest.mock import Mock, patch
selfdrive/thermald/tests/test_power_monitoring.py
2:from unittest.mock import patch
selfdrive/athena/tests/test_registration.py
5:from unittest import mock
selfdrive/athena/tests/test_athenad_ping.py
7:from unittest import mock
selfdrive/athena/tests/test_athenad.py
16:from unittest import mock
selfdrive/car/tests/test_models.py
7:import unittest
158: raise unittest.SkipTest
163: raise unittest.SkipTest
selfdrive/car/tests/test_docs.py
6:import unittest
87: raise unittest.SkipTest
selfdrive/car/tests/test_lateral_limits.py
6:import unittest
38: raise unittest.SkipTest("Platform is behind dashcamOnly")
42: raise unittest.SkipTest
45: raise unittest.SkipTest
78: result = unittest.main(exit=False)
selfdrive/car/tests/test_fw_fingerprint.py
5:import unittest
8:from unittest import mock
66: raise unittest.SkipTest("Brand does not implement custom fuzzy fingerprinting function")
88: raise unittest.SkipTest("Car model has no compatible ECUs for fuzzy matching")
selfdrive/boardd/tests/test_pandad.py
5:import unittest
113: raise unittest.SkipTest("SPI test")
selfdrive/car/hyundai/tests/test_hyundai.py
4:import unittest
72: raise unittest.SkipTest("Skip checking Santa Cruz for its parts")
158: raise unittest.SkipTest("No part numbers for car model")
selfdrive/car/ford/tests/test_ford.py
3:import unittest
149: unittest.main()
selfdrive/car/volkswagen/tests/test_volkswagen.py
4:import unittest
66: unittest.main()
selfdrive/ui/tests/test_ui/run.py
11:import unittest
191: unittest.main(exit=False)
I suggest we add "unittest".msg = "use pytest!" to ruff's banned-api
Closing, this is a very simple change that shouldn't require as much review as this has gotten so far.