54e6124925
version: sunnypilot v2026.001.000 (dev) date: 2026-05-07T23:07:19 master commit: c28eb958740187620f2282023b8f1997cf90f583
20 lines
448 B
Python
20 lines
448 B
Python
import os
|
|
from uuid import uuid4
|
|
|
|
from openpilot.common.utils import atomic_write
|
|
|
|
|
|
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(self):
|
|
self.run_atomic_write_func(atomic_write)
|