Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test_aptpkg: Skip tests if /etc/apt/sources.list is missing
If `/etc/apt/sources.list` does not exist, three functional test cases fail with ``` FileNotFoundError: [Errno 2] No such file or directory: '/etc/apt/sources.list' ``` because they try to open this files: ``` ________________________________ test_get_repos ________________________________ def test_get_repos(): """ Test aptpkg.get_repos """ > test_repo, comps = get_current_repo() /<<PKGBUILDDIR>>/tests/pytests/functional/modules/test_aptpkg.py:109: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /<<PKGBUILDDIR>>/tests/pytests/functional/modules/test_aptpkg.py:64: in get_current_repo with salt.utils.files.fopen("/etc/apt/sources.list") as fp: ________________________ test_get_repos_multiple_comps _________________________ def test_get_repos_multiple_comps(): """ Test aptpkg.get_repos when multiple comps exist in repo. """ > test_repo, comps = get_current_repo(multiple_comps=True) /<<PKGBUILDDIR>>/tests/pytests/functional/modules/test_aptpkg.py:126: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /<<PKGBUILDDIR>>/tests/pytests/functional/modules/test_aptpkg.py:64: in get_current_repo with salt.utils.files.fopen("/etc/apt/sources.list") as fp: _____________________________ test_expand_repo_def _____________________________ def test_expand_repo_def(): """ Test aptpkg.expand_repo_def when the repo exists. """ > test_repo, comps = get_current_repo() /<<PKGBUILDDIR>>/tests/pytests/functional/modules/test_aptpkg.py:169: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /<<PKGBUILDDIR>>/tests/pytests/functional/modules/test_aptpkg.py:64: in get_current_repo with salt.utils.files.fopen("/etc/apt/sources.list") as fp: ``` Some Debian buildd do not have `/etc/apt/sources.list` and therefore these test cases fail: https://buildd.debian.org/status/fetch.php?pkg=salt&arch=all&ver=3004%2Bdfsg1-9&stamp=1644870337&raw=0 So just skip these test cases if `/etc/apt/sources.list` does not exist. Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
- Loading branch information