diff options
author | Viljami Ilola <+@hix.fi> | 2024-04-21 00:38:52 +0300 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-04-21 00:38:52 +0300 |
commit | d65522d45b17a860413ccd6a6537e33078a58cae (patch) | |
tree | 60014e801c6aaeee8ce7122649d69a232232a836 | |
parent | cc647b1c0f5f7f8a700103c6312916db126f8ffc (diff) |
fix tests to use pathlib also
-rw-r--r-- | tests/test_highscores.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/tests/test_highscores.py b/tests/test_highscores.py index 26545f0..048a42c 100644 --- a/tests/test_highscores.py +++ b/tests/test_highscores.py @@ -1,16 +1,14 @@ -import os +from pathlib import Path import unittest import pygame -from pathlib import Path - from sliceitoff.hiscores import HiScores class TestHiScores(unittest.TestCase): def setUp(self): - self.filename = "/tmp/sliceitoff-hiscores-test" - if os.path.isfile(self.filename): - os.remove(self.filename) + self.filename = Path("/tmp/sliceitoff-hiscores-test") + if self.filename.is_file(): + self.filename.unlink() self.hiscores = HiScores(filename = self.filename) def tearDown(self): @@ -18,15 +16,15 @@ class TestHiScores(unittest.TestCase): del self.hiscores except AttributeError: pass - if os.path.isfile(self.filename): - os.remove(self.filename) + if self.filename.is_file(): + self.filename.unlink() def test_can_create(self): self.assertNotEqual(None, self.hiscores) def test_config_file_is_created_on_exit(self): del self.hiscores - self.assertTrue(os.path.isfile(self.filename)) + self.assertTrue(self.filename.is_file()) def test_scores_can_be_added(self): self.hiscores.add(500_000,"HUH") |