Split tests into specifically named test cases
This commit is contained in:
parent
f06acc20a5
commit
f33cf3c8a9
@ -8,9 +8,6 @@ import unittest
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from unittest.mock import DEFAULT, patch
|
from unittest.mock import DEFAULT, patch
|
||||||
|
|
||||||
from hypothesis import given
|
|
||||||
from hypothesis.strategies import from_regex
|
|
||||||
|
|
||||||
from rbackup.struct.hierarchy import Hierarchy
|
from rbackup.struct.hierarchy import Hierarchy
|
||||||
|
|
||||||
# ========== Constants ==========
|
# ========== Constants ==========
|
||||||
@ -20,6 +17,8 @@ TESTING_MODULE = f"{TESTING_PACKAGE}.hierarchy"
|
|||||||
|
|
||||||
# ========== Tests ==========
|
# ========== Tests ==========
|
||||||
class TestHierarchyPaths(unittest.TestCase):
|
class TestHierarchyPaths(unittest.TestCase):
|
||||||
|
"""Check given path properties of a Hierarchy object."""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.patched_path = patch.multiple(
|
self.patched_path = patch.multiple(
|
||||||
Path, exists=DEFAULT, mkdir=DEFAULT, symlink_to=DEFAULT, touch=DEFAULT
|
Path, exists=DEFAULT, mkdir=DEFAULT, symlink_to=DEFAULT, touch=DEFAULT
|
||||||
@ -30,16 +29,29 @@ class TestHierarchyPaths(unittest.TestCase):
|
|||||||
def test_retrieves_correct_metadata_filename(self):
|
def test_retrieves_correct_metadata_filename(self):
|
||||||
self.assertEqual(Hierarchy("/tmp/backup").metadata_path.name, ".metadata")
|
self.assertEqual(Hierarchy("/tmp/backup").metadata_path.name, ".metadata")
|
||||||
|
|
||||||
def test_raises_notimplemented_error(self):
|
|
||||||
h = Hierarchy("/tmp/backup")
|
|
||||||
with self.assertRaises(NotImplementedError):
|
|
||||||
h._gen_metadata()
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
patch.stopall()
|
patch.stopall()
|
||||||
|
|
||||||
|
|
||||||
class TestHierarchyMetadata(unittest.TestCase):
|
class TestHierarchyMetadata(unittest.TestCase):
|
||||||
|
"""Test intrusive metadata methods of a Hierarchy object."""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.patched_path = patch.multiple(
|
||||||
|
Path, exists=DEFAULT, mkdir=DEFAULT, symlink_to=DEFAULT, touch=DEFAULT
|
||||||
|
)
|
||||||
|
|
||||||
|
self.mocked_path = self.patched_path.start()
|
||||||
|
|
||||||
|
def test_gen_metadata_raises_notimplemented_error(self):
|
||||||
|
with self.assertRaises(NotImplementedError):
|
||||||
|
Hierarchy("/tmp/backup")._gen_metadata()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
patch.stopall()
|
||||||
|
|
||||||
|
|
||||||
|
class TestHierarchyMetadataIO(unittest.TestCase):
|
||||||
"""Only meant to check that data written is the same data that is read."""
|
"""Only meant to check that data written is the same data that is read."""
|
||||||
|
|
||||||
def test_write_metadata(self):
|
def test_write_metadata(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user