43 lines
1.3 KiB
Python
43 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
import shutil
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
import jprm
|
|
from .utils_test import TEST_DATA_DIR
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
'datafiles', [TEST_DATA_DIR / 'jprm.yaml'],
|
|
) # type: ignore[untyped-decorator]
|
|
def test_package_plugin(tmp_path, datafiles: Path) -> None: # type: ignore[no-untyped-def]
|
|
bindir: Path = tmp_path / 'bin'
|
|
plugin: Path = tmp_path / 'plugin'
|
|
artifacts: Path = tmp_path / 'artifacts'
|
|
|
|
for path in (bindir, plugin, artifacts):
|
|
path.mkdir(parents=True)
|
|
|
|
(bindir / 'dummy.dll').write_text('', 'utf-8')
|
|
|
|
shutil.copy(datafiles, plugin)
|
|
build_cfg = jprm.load_build_config(plugin / 'jprm.yaml')
|
|
assert build_cfg, 'failed to load jprm.yaml'
|
|
|
|
output_path = Path(
|
|
jprm.package_plugin(
|
|
path=plugin, build_cfg=build_cfg,
|
|
version='5.0', binary_path=bindir, output=artifacts,
|
|
),
|
|
)
|
|
|
|
assert output_path.exists()
|
|
assert (artifacts / 'plugin-a_5.0.0.0.zip').is_file()
|
|
assert (artifacts / 'plugin-a_5.0.0.0.zip.meta.json').is_file()
|
|
assert (artifacts / 'plugin-a_5.0.0.0.zip.md5sum').is_file()
|
|
|
|
subprocess.run(('md5sum', '-c', 'plugin-a_5.0.0.0.zip.md5sum'), capture_output=True, cwd=artifacts, check=True)
|