Skip to content

Commit

Permalink
in common class
Browse files Browse the repository at this point in the history
  • Loading branch information
dbungert committed Sep 11, 2023
1 parent f997d66 commit 1d30b12
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
10 changes: 10 additions & 0 deletions probert/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from unittest import IsolatedAsyncioTestCase
from unittest.mock import patch


class ProbertTestCase(IsolatedAsyncioTestCase):
def setUp(self):
which = patch("probert.filesystem.shutil.which")
self.m_which = which.start()
self.m_which.return_value = '/bin/false'
self.addCleanup(which.stop)
9 changes: 5 additions & 4 deletions probert/tests/test_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
get_swap_sizing,
get_device_filesystem,
)
from probert.tests import ProbertTestCase


def read_file(filename):
Expand Down Expand Up @@ -60,8 +61,7 @@ async def test_expected_output_vg(self):
assert expected == await get_swap_sizing(device)


@patch('probert.filesystem.shutil.which', new=Mock(return_value='/bin/false'))
class TestFilesystem(IsolatedAsyncioTestCase):
class TestFilesystem(ProbertTestCase):
def setUp(self):
self.device = Mock()
self.device.device_node = random_string()
Expand Down Expand Up @@ -198,10 +198,11 @@ async def test_get_device_filesystem_sizing_ext4_no_min(self):
self.assertEqual(expected, actual)


@patch('probert.filesystem.shutil.which', new=Mock(return_value=None))
class TestFilesystemToolNotFound(IsolatedAsyncioTestCase):
class TestFilesystemToolNotFound(ProbertTestCase):
def setUp(self):
super().setUp()
self.device = Mock()
self.m_which.return_value = None

async def test_ntfsresize_not_found(self):
self.assertEqual(None, await get_ntfs_sizing(self.device))
Expand Down

0 comments on commit 1d30b12

Please sign in to comment.