packages/test_device: add test for initialise_pkgbuilds_dir fixture

This commit is contained in:
InsanePrawn 2022-08-20 04:36:53 +02:00
parent f5e3fa46ad
commit 39be2b2fb6

View file

@ -39,9 +39,10 @@ ONEPLUS_ENCHILADA_PKG = f'device-{ONEPLUS_ENCHILADA}'
@pytest.fixture(scope='session')
def enchilada_pkgbuild(initialise_pkgbuilds_dir):
def enchilada_pkgbuild(initialise_pkgbuilds_dir: ConfigStateHolder):
config = initialise_pkgbuilds_dir
config.try_load_file()
return parse_pkgbuild(os.path.join('device', ONEPLUS_ENCHILADA_PKG))[0]
return parse_pkgbuild(os.path.join('device', ONEPLUS_ENCHILADA_PKG), config)[0]
def validate_oneplus_enchilada(d: Device):
@ -50,6 +51,14 @@ def validate_oneplus_enchilada(d: Device):
assert d.package and d.package.name == ONEPLUS_ENCHILADA_PKG
def test_fixture_initialise_pkgbuilds_dir(initialise_pkgbuilds_dir: ConfigStateHolder):
assert os.path.exists(os.path.join(config.get_path('pkgbuilds'), 'device'))
def test_fixture_pkgbuilds_dir(pkgbuilds_dir):
assert os.path.exists(os.path.join(pkgbuilds_dir, 'device'))
def test_get_device():
name = ONEPLUS_ENCHILADA
d = get_device(name)