Skip to content

Commit 56c5791

Browse files
committed
Add player unittest
1 parent 7e59007 commit 56c5791

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

test/data/test_CanMessage.asc.gz

277 Bytes
Binary file not shown.

test/test_player.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616

1717
class TestPlayerScriptModule(unittest.TestCase):
18+
19+
logfile = os.path.join(os.path.dirname(__file__), "data", "test_CanMessage.asc")
20+
1821
def setUp(self) -> None:
1922
# Patch VirtualBus object
2023
patcher_virtual_bus = mock.patch("can.interfaces.virtual.VirtualBus", spec=True)
@@ -29,9 +32,6 @@ def setUp(self) -> None:
2932
self.addCleanup(patcher_sleep.stop)
3033

3134
self.baseargs = [sys.argv[0], "-i", "virtual"]
32-
self.logfile = os.path.join(
33-
os.path.dirname(__file__), "data", "test_CanMessage.asc"
34-
)
3535

3636
def assertSuccessfulCleanup(self):
3737
self.MockVirtualBus.assert_called_once()
@@ -111,5 +111,13 @@ def test_play_error_frame(self):
111111
self.assertSuccessfulCleanup()
112112

113113

114+
class TestPlayerCompressedFile(TestPlayerScriptModule):
115+
"""
116+
Re-run tests using a compressed file.
117+
"""
118+
119+
logfile = os.path.join(os.path.dirname(__file__), "data", "test_CanMessage.asc.gz")
120+
121+
114122
if __name__ == "__main__":
115123
unittest.main()

0 commit comments

Comments
 (0)