You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@burr.apache.org by "skrawcz (via GitHub)" <gi...@apache.org> on 2026/04/20 04:54:29 UTC
Re: [PR] ci: improve artifact verification flow [burr]
skrawcz commented on code in PR #741:
URL: https://github.com/apache/burr/pull/741#discussion_r3108306036
##########
tests/test_verify_apache_artifacts.py:
##########
@@ -0,0 +1,268 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import importlib.util
+import sys
+import tarfile
+import tempfile
+import unittest
+import zipfile
+from pathlib import Path
+from unittest import mock
+
+
+def _load_verify_module():
+ module_path = Path(__file__).resolve().parent.parent / "scripts" / "verify_apache_artifacts.py"
+ spec = importlib.util.spec_from_file_location("verify_apache_artifacts", module_path)
+ module = importlib.util.module_from_spec(spec)
+ assert spec.loader is not None
+ sys.modules[spec.name] = module
+ spec.loader.exec_module(module)
+ return module
+
+
+verify = _load_verify_module()
+
+
+def _reference_text(filename: str) -> bytes:
+ return (Path(__file__).resolve().parent.parent / filename).read_bytes()
+
+
+def _write_tar_gz(path: Path, root: str, files: dict[str, bytes]) -> None:
+ with tarfile.open(path, "w:gz") as tar:
+ for relative_name, content in files.items():
+ with tempfile.NamedTemporaryFile(delete=False, dir=path.parent) as temp_file:
+ temp_path = Path(temp_file.name)
+ temp_path.write_bytes(content)
+ tar.add(temp_path, arcname=f"{root}/{relative_name}")
+ temp_path.unlink()
+
+
+def _write_wheel(path: Path, files: dict[str, bytes]) -> None:
+ with zipfile.ZipFile(path, "w") as wheel:
+ for name, content in files.items():
+ wheel.writestr(name, content)
+
+
+class VerifyApacheArtifactsTests(unittest.TestCase):
Review Comment:
can we change to pytest please.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@burr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org