Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Aug 1, 2024
1 parent 13c6247 commit 8e5ddf1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions qgispluginci/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def create_archive(
if not Path(f"{parameters.plugin_path}/LICENSE").is_file():
parent_license = Path(f"{parameters.plugin_path}/../LICENSE")
if parent_license.is_file():
shutil.copy(str(parent_license.resolve()), f"{parameters.plugin_path}/LICENSE")
shutil.copy(parent_license, f"{parameters.plugin_path}/LICENSE")
parent_folder_license_copied = True
with tarfile.open(top_tar_file, mode="a") as tt:
tt.add(f"{parameters.plugin_path}/LICENSE")
Expand Down Expand Up @@ -277,8 +277,8 @@ def create_archive(
zf.writestr(info, fl)

if parent_folder_license_copied:
os.remove(f"{parameters.plugin_path}/LICENSE")
Path(f"{parameters.plugin_path}/LICENSE").unlink()

logger.debug("-" * 40)
logger.debug(f"Files in ZIP archive ({archive_name}):")
with zipfile.ZipFile(file=archive_name, mode="r") as zf:
Expand Down
14 changes: 11 additions & 3 deletions test/test_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import yaml
from github import Github, GithubException

# Tests
from utils import can_skip_test_github

# Project
from qgispluginci.changelog import ChangelogParser
from qgispluginci.exceptions import GithubReleaseNotFound
Expand All @@ -24,9 +27,6 @@
from qgispluginci.translation import Translation
from qgispluginci.utils import replace_in_file

# Tests
from .utils import can_skip_test_github

# If changed, also update CHANGELOG.md
RELEASE_VERSION_TEST = "0.1.2"

Expand Down Expand Up @@ -196,6 +196,7 @@ def test_release_changelog(self):
# open archive and compare
with ZipFile(archive_name, "r") as zip_file:
data = zip_file.read(f"{parameters.plugin_path}/metadata.txt")
license_data = zip_file.read(f"{parameters.plugin_path}/LICENSE")

# Changelog
self.assertGreater(
Expand All @@ -204,6 +205,13 @@ def test_release_changelog(self):
f"changelog detection failed in release: {data}",
)

# License
self.assertGreater(
license_data.find(bytes("GNU GENERAL PUBLIC LICENSE", "utf8")),
0,
"license file content mismatch",
)

# Commit number
self.assertEqual(1, len(re.findall(r"commitNumber=\d+", str(data))))

Expand Down

0 comments on commit 8e5ddf1

Please sign in to comment.