Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make probert buildable again on noble #147

Merged
merged 3 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ Build-Depends: debhelper-compat (= 13),
libnl-route-3-dev,
pkg-config,
python3-all-dev,
python3-coverage,
python3-flake8,
python3-jsonschema,
python3-nose,
python3-parameterized,
python3-pyudev,
python3-coverage <!nocheck>,
python3-flake8 <!nocheck>,
python3-jsonschema <!nocheck>,
python3-nose <!nocheck>,
python3-parameterized <!nocheck>,
python3-pyudev <!nocheck>,
python3-setuptools,
Standards-Version: 4.5.0
Homepage: https://github.com/canonical/probert
Expand Down
3 changes: 3 additions & 0 deletions probert/tests/test_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,21 @@ async def test_ext4_bad_resize2fs(self, dumpe2fs, resize2fs):
self.assertEqual(expected, await get_ext_sizing(self.device))

@patch('probert.filesystem.arun')
@patch('probert.filesystem.shutil.which', Mock())
async def test_ntfs_real_output(self, run):
run.return_value = read_file('probert/tests/data/ntfsresize.out')
expected = {'SIZE': 41939456, 'ESTIMATED_MIN_SIZE': 2613248}
self.assertEqual(expected, await get_ntfs_sizing(self.device))

@patch('probert.filesystem.arun')
@patch('probert.filesystem.shutil.which', Mock())
async def test_ntfs_real_output_full(self, run):
run.return_value = read_file('probert/tests/data/ntfsresize_full.out')
expected = {'SIZE': 83882496, 'ESTIMATED_MIN_SIZE': 83882496}
self.assertEqual(expected, await get_ntfs_sizing(self.device))

@patch('probert.filesystem.arun')
@patch('probert.filesystem.shutil.which', Mock())
async def test_ntfs_simple_output(self, run):
run.return_value = '''
Current volume size: 100000000 bytes (100 MB)
Expand Down
7 changes: 6 additions & 1 deletion probert/tests/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import subprocess
from unittest import IsolatedAsyncioTestCase
from unittest.mock import patch
from unittest.mock import patch, Mock

from probert.os import probe, _parse_osprober, _run_os_prober

Expand Down Expand Up @@ -121,6 +121,7 @@ def test_winxp(self):
self.assertEqual(expected, _parse_osprober(lines))

@patch('probert.os.subprocess.run')
@patch('probert.os.shutil.which', Mock())
async def test_osx_run(self, run):
run.return_value.stdout = '/dev/sda4:Mac OS X:MacOSX:macosx\n'
expected = {
Expand All @@ -133,21 +134,25 @@ async def test_osx_run(self, run):
self.assertEqual(expected, await probe())

@patch('probert.os.subprocess.run')
@patch('probert.os.shutil.which', Mock())
async def test_empty_run(self, run):
run.return_value.stdout = ''
self.assertEqual({}, await probe())

@patch('probert.os.subprocess.run')
@patch('probert.os.shutil.which', Mock())
async def test_none_run(self, run):
run.return_value.stdout = None
self.assertEqual({}, await probe())

@patch('probert.os.subprocess.run')
@patch('probert.os.shutil.which', Mock())
async def test_osprober_fail(self, run):
run.side_effect = subprocess.CalledProcessError(1, 'cmd')
self.assertEqual({}, await probe())

@patch('probert.os.subprocess.run')
@patch('probert.os.shutil.which', Mock())
async def test_run_once(self, run):
run.return_value.stdout = ''
self.assertEqual({}, await probe())
Expand Down
Loading