diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-05-11 12:33:31 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-05-11 12:33:31 +0200 |
commit | 496d90f70a58c0040f8493aa8a5e4e2f106bfac7 (patch) | |
tree | af6ace104ad9a02f2fb15820dd6ea3469d4577d5 /tests/test_local_apt.py | |
parent | 9e2cd3a25b6ff5addd7109414fdf5a535b9cbce3 (diff) | |
download | hydrilla-builder-496d90f70a58c0040f8493aa8a5e4e2f106bfac7.tar.gz hydrilla-builder-496d90f70a58c0040f8493aa8a5e4e2f106bfac7.zip |
make it easier to reuse/cache foreign package files when building a Hydrilla source package multiple times
Diffstat (limited to 'tests/test_local_apt.py')
-rw-r--r-- | tests/test_local_apt.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tests/test_local_apt.py b/tests/test_local_apt.py index edd47fa..f94ee37 100644 --- a/tests/test_local_apt.py +++ b/tests/test_local_apt.py @@ -341,7 +341,7 @@ def test_local_apt_download(mock_cache_dir): destination.mkdir() local_apt.download_apt_packages(sources_list, local_apt.default_keys, - ['libjs-mathjax'], destination) + ['libjs-mathjax'], destination, False) libjs_mathjax_path = destination / 'libjs-mathjax_0%3a2.7.9+dfsg-1_all.deb' fonts_mathjax_path = destination / 'fonts-mathjax_0%3a2.7.9+dfsg-1_all.deb' @@ -418,7 +418,7 @@ $\ with pytest.raises(local_apt.AptError, match=error_regex): local_apt.download_apt_packages(sources_list, local_apt.default_keys, - ['libjs-mathjax'], destination) + ['libjs-mathjax'], destination, False) assert [*destination.iterdir()] == [] @@ -469,7 +469,7 @@ $\ with pytest.raises(local_apt.AptError, match=error_regex): local_apt.download_apt_packages(sources_list, local_apt.default_keys, - ['libjs-mathjax'], destination) + ['libjs-mathjax'], destination, False) assert [*destination.iterdir()] == [] @@ -499,7 +499,7 @@ $\ with pytest.raises(local_apt.AptError, match=error_regex): local_apt.download_apt_packages(sources_list, local_apt.default_keys, - ['libjs-mathjax'], destination) + ['libjs-mathjax'], destination, False) assert [*destination.iterdir()] == [] @@ -572,7 +572,8 @@ def mock_download_packages(monkeypatch): 'base_depends': True, 'identity': 'nabia', 'props': {'distribution': 'nabia', 'dependencies': False}, - 'all_keys': local_apt.default_keys + 'all_keys': local_apt.default_keys, + 'prepared_directory': False }, { 'with_deps': True, @@ -586,19 +587,22 @@ def mock_download_packages(monkeypatch): 'depend_on_base_packages': False }, 'all_keys': [*local_apt.default_keys, 'AB' * 20], + 'prepared_directory': True } ]) @pytest.mark.usefixtures('mock_download_packages', 'mock_subprocess_run') -def test_piggybacked_system_download(params): +def test_piggybacked_system_download(params, tmpdir): """ Verify that the piggybacked_system() function properly downloads and unpacks APT packages. """ + foreign_packages_dir = tmpdir if params['prepared_directory'] else None + with local_apt.piggybacked_system({ 'system': 'apt', **params['props'], 'packages': ['some-bin-package', 'another-package=1.1-2'] - }, None) as piggybacked: + }, foreign_packages_dir) as piggybacked: expected_depends = [{'identifier': 'apt-common-licenses'}] \ if params['base_depends'] else [] assert piggybacked.package_must_depend == expected_depends @@ -626,6 +630,9 @@ def test_piggybacked_system_download(params): else: assert path.read_text() == f'dummy {path.name}' + if foreign_packages_dir is not None: + assert path.parent == foreign_packages_dir / 'apt' + license_files = {*piggybacked.package_license_files} assert license_files == { @@ -654,6 +661,9 @@ def test_piggybacked_system_download(params): assert not root.exists() + if foreign_packages_dir: + assert [*tmpdir.iterdir()] == [tmpdir / 'apt'] + @pytest.mark.subprocess_run(local_apt, run_dpkg_deb) @pytest.mark.usefixtures('mock_subprocess_run') def test_piggybacked_system_no_download(): |