mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 23:33:58 +08:00
* add pytest-asyncio
* switch common
* switch selfdrive
* switch system
* switch tools
* small fixes
* fix setUp and valgrind pytest
* switch to setup
* fix random
* switch mock
* switch test_lateral_limits
* revert test_ui
* fix poetry.lock
* add unittest to banned-api
* add inline ignores to remaining unittest imports
* revert test_models
* revert check_can_parser_performance
* one more skip
---------
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: dd9d5d4528
20 lines
476 B
Python
20 lines
476 B
Python
import os
|
|
from uuid import uuid4
|
|
|
|
from openpilot.common.file_helpers import atomic_write_in_dir
|
|
|
|
|
|
class TestFileHelpers:
|
|
def run_atomic_write_func(self, atomic_write_func):
|
|
path = f"/tmp/tmp{uuid4()}"
|
|
with atomic_write_func(path) as f:
|
|
f.write("test")
|
|
assert not os.path.exists(path)
|
|
|
|
with open(path) as f:
|
|
assert f.read() == "test"
|
|
os.remove(path)
|
|
|
|
def test_atomic_write_in_dir(self):
|
|
self.run_atomic_write_func(atomic_write_in_dir)
|