mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
Merge pull request #229 from yan12125/fix-test-alpmfiles
Fix test_alpmfiles in Arch chroots
This commit is contained in:
commit
4e7dce4e93
1 changed files with 26 additions and 1 deletions
|
@ -1,20 +1,45 @@
|
|||
# MIT licensed
|
||||
# Copyright (c) 2023 Pekka Ristola <pekkarr [at] protonmail [dot] com>, et al.
|
||||
|
||||
import pathlib
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.asyncio,
|
||||
pytest.mark.skipif(shutil.which('pacman') is None, reason='requires pacman command'),
|
||||
pytest.mark.skipif(shutil.which('fakeroot') is None, reason='requires fakeroot command'),
|
||||
]
|
||||
|
||||
global temp_dir, db_path
|
||||
|
||||
|
||||
def setup_module(module):
|
||||
global temp_dir, db_path
|
||||
|
||||
temp_dir = tempfile.TemporaryDirectory()
|
||||
temp_path = pathlib.Path(temp_dir.name)
|
||||
db_path = temp_path / 'test-db'
|
||||
|
||||
db_path.mkdir(exist_ok=True)
|
||||
|
||||
cmd = ['fakeroot', 'pacman', '-Fy', '--dbpath', db_path]
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
|
||||
def teardown_module(module):
|
||||
temp_dir.cleanup()
|
||||
|
||||
|
||||
async def test_alpmfiles(get_version):
|
||||
assert await get_version('test', {
|
||||
'source': 'alpmfiles',
|
||||
'pkgname': 'libuv',
|
||||
'filename': 'usr/lib/libuv\\.so\\.([^.]+)',
|
||||
'dbpath': db_path,
|
||||
}) == '1'
|
||||
|
||||
async def test_alpmfiles_strip(get_version):
|
||||
|
@ -24,5 +49,5 @@ async def test_alpmfiles_strip(get_version):
|
|||
'repo': 'core',
|
||||
'filename': 'libc\\.so\\.[^.]+',
|
||||
'strip_dir': True,
|
||||
'dbpath': '/var/lib/pacman',
|
||||
'dbpath': db_path,
|
||||
}) == 'libc.so.6'
|
||||
|
|
Loading…
Add table
Reference in a new issue