Revision 496d90f7
Added by koszko over 1 year ago
| tests/test_local_apt.py | ||
|---|---|---|
| 341 | 341 |
destination.mkdir() |
| 342 | 342 |
|
| 343 | 343 |
local_apt.download_apt_packages(sources_list, local_apt.default_keys, |
| 344 |
['libjs-mathjax'], destination) |
|
| 344 |
['libjs-mathjax'], destination, False)
|
|
| 345 | 345 |
|
| 346 | 346 |
libjs_mathjax_path = destination / 'libjs-mathjax_0%3a2.7.9+dfsg-1_all.deb' |
| 347 | 347 |
fonts_mathjax_path = destination / 'fonts-mathjax_0%3a2.7.9+dfsg-1_all.deb' |
| ... | ... | |
| 418 | 418 |
|
| 419 | 419 |
with pytest.raises(local_apt.AptError, match=error_regex): |
| 420 | 420 |
local_apt.download_apt_packages(sources_list, local_apt.default_keys, |
| 421 |
['libjs-mathjax'], destination) |
|
| 421 |
['libjs-mathjax'], destination, False)
|
|
| 422 | 422 |
|
| 423 | 423 |
assert [*destination.iterdir()] == [] |
| 424 | 424 |
|
| ... | ... | |
| 469 | 469 |
|
| 470 | 470 |
with pytest.raises(local_apt.AptError, match=error_regex): |
| 471 | 471 |
local_apt.download_apt_packages(sources_list, local_apt.default_keys, |
| 472 |
['libjs-mathjax'], destination) |
|
| 472 |
['libjs-mathjax'], destination, False)
|
|
| 473 | 473 |
|
| 474 | 474 |
assert [*destination.iterdir()] == [] |
| 475 | 475 |
|
| ... | ... | |
| 499 | 499 |
|
| 500 | 500 |
with pytest.raises(local_apt.AptError, match=error_regex): |
| 501 | 501 |
local_apt.download_apt_packages(sources_list, local_apt.default_keys, |
| 502 |
['libjs-mathjax'], destination) |
|
| 502 |
['libjs-mathjax'], destination, False)
|
|
| 503 | 503 |
|
| 504 | 504 |
assert [*destination.iterdir()] == [] |
| 505 | 505 |
|
| ... | ... | |
| 572 | 572 |
'base_depends': True, |
| 573 | 573 |
'identity': 'nabia', |
| 574 | 574 |
'props': {'distribution': 'nabia', 'dependencies': False},
|
| 575 |
'all_keys': local_apt.default_keys |
|
| 575 |
'all_keys': local_apt.default_keys, |
|
| 576 |
'prepared_directory': False |
|
| 576 | 577 |
}, |
| 577 | 578 |
{
|
| 578 | 579 |
'with_deps': True, |
| ... | ... | |
| 586 | 587 |
'depend_on_base_packages': False |
| 587 | 588 |
}, |
| 588 | 589 |
'all_keys': [*local_apt.default_keys, 'AB' * 20], |
| 590 |
'prepared_directory': True |
|
| 589 | 591 |
} |
| 590 | 592 |
]) |
| 591 | 593 |
@pytest.mark.usefixtures('mock_download_packages', 'mock_subprocess_run')
|
| 592 |
def test_piggybacked_system_download(params): |
|
| 594 |
def test_piggybacked_system_download(params, tmpdir):
|
|
| 593 | 595 |
""" |
| 594 | 596 |
Verify that the piggybacked_system() function properly downloads and unpacks |
| 595 | 597 |
APT packages. |
| 596 | 598 |
""" |
| 599 |
foreign_packages_dir = tmpdir if params['prepared_directory'] else None |
|
| 600 |
|
|
| 597 | 601 |
with local_apt.piggybacked_system({
|
| 598 | 602 |
'system': 'apt', |
| 599 | 603 |
**params['props'], |
| 600 | 604 |
'packages': ['some-bin-package', 'another-package=1.1-2'] |
| 601 |
}, None) as piggybacked:
|
|
| 605 |
}, foreign_packages_dir) as piggybacked:
|
|
| 602 | 606 |
expected_depends = [{'identifier': 'apt-common-licenses'}] \
|
| 603 | 607 |
if params['base_depends'] else [] |
| 604 | 608 |
assert piggybacked.package_must_depend == expected_depends |
| ... | ... | |
| 626 | 630 |
else: |
| 627 | 631 |
assert path.read_text() == f'dummy {path.name}'
|
| 628 | 632 |
|
| 633 |
if foreign_packages_dir is not None: |
|
| 634 |
assert path.parent == foreign_packages_dir / 'apt' |
|
| 635 |
|
|
| 629 | 636 |
license_files = {*piggybacked.package_license_files}
|
| 630 | 637 |
|
| 631 | 638 |
assert license_files == {
|
| ... | ... | |
| 654 | 661 |
|
| 655 | 662 |
assert not root.exists() |
| 656 | 663 |
|
| 664 |
if foreign_packages_dir: |
|
| 665 |
assert [*tmpdir.iterdir()] == [tmpdir / 'apt'] |
|
| 666 |
|
|
| 657 | 667 |
@pytest.mark.subprocess_run(local_apt, run_dpkg_deb) |
| 658 | 668 |
@pytest.mark.usefixtures('mock_subprocess_run')
|
| 659 | 669 |
def test_piggybacked_system_no_download(): |
Also available in: Unified diff
make it easier to reuse/cache foreign package files when building a Hydrilla source package multiple times