From 7ab8d86396cf84cfeedae086f261b9596691d748 Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Sun, 08 Feb 2026 01:15:14 +0000
Subject: [PATCH] Try to allow vcs rebuilds
---
tests/integration_test.py | 51 +++++++++++++++++++++++++++++++++++----------------
1 files changed, 35 insertions(+), 16 deletions(-)
diff --git a/tests/integration_test.py b/tests/integration_test.py
index cad5ccc..2f141ed 100644
--- a/tests/integration_test.py
+++ b/tests/integration_test.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
-Integration test script for archbuild.
+Integration test script for archrepobuild.
This script creates a temporary repository, initializes it with a basic config,
adds test packages, and verifies they build and are added correctly.
@@ -23,11 +23,11 @@
# Add src to path for development
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
-from archbuild.aur import AURClient
-from archbuild.builder import Builder, BuildStatus
-from archbuild.config import Config, RepositoryConfig, BuildingConfig, SigningConfig, PackageOverride
-from archbuild.logging import setup_logging, console
-from archbuild.repo import RepoManager
+from archrepobuild.aur import AURClient
+from archrepobuild.builder import Builder, BuildStatus
+from archrepobuild.config import Config, RepositoryConfig, BuildingConfig, SigningConfig, PackageOverride
+from archrepobuild.logging import setup_logging, console
+from archrepobuild.repo import RepoManager
# Test packages - real packages that exist in the AUR
@@ -47,9 +47,10 @@
class IntegrationTest:
"""Integration test runner."""
- def __init__(self, keep_temp: bool = False, use_cli: bool = False):
+ def __init__(self, keep_temp: bool = False, use_cli: bool = False, use_binary: bool = False):
self.keep_temp = keep_temp
self.use_cli = use_cli
+ self.use_binary = use_binary
self.temp_dir: Path | None = None
self.config: Config | None = None
self.config_path: Path | None = None
@@ -57,15 +58,24 @@
self.failed = 0
def _run_cli(self, command: str, *args: str) -> subprocess.CompletedProcess:
- """Run archbuild CLI command via subprocess."""
+ """Run archrepobuild CLI command via subprocess."""
if not self.config_path:
raise RuntimeError("Config path not set")
env = os.environ.copy()
- # Add src to PYTHONPATH so the CLI can find the package
- env["PYTHONPATH"] = str(Path(__file__).parent.parent / "src")
- cmd = [sys.executable, "-m", "archbuild.cli", "-c", str(self.config_path), command] + list(args)
+ if self.use_binary:
+ binary_path = Path(__file__).parent.parent / "dist" / "archrepobuild"
+ if not binary_path.exists():
+ raise RuntimeError(f"Binary not found at {binary_path}. Run scripts/build_binary.py first.")
+
+ cmd = [str(binary_path), "-c", str(self.config_path), command] + list(args)
+ # No PYTHONPATH needed for the standalone binary
+ else:
+ # Add src to PYTHONPATH so the CLI can find the package
+ env["PYTHONPATH"] = str(Path(__file__).parent.parent / "src")
+ cmd = [sys.executable, "-m", "archrepobuild.cli", "-c", str(self.config_path), command] + list(args)
+
return subprocess.run(cmd, capture_output=True, text=True, env=env)
def setup(self) -> None:
@@ -73,7 +83,7 @@
console.print("\n[bold blue]═══ Setting up test environment ═══[/]")
# Create temp directory
- self.temp_dir = Path(tempfile.mkdtemp(prefix="archbuild_test_"))
+ self.temp_dir = Path(tempfile.mkdtemp(prefix="archrepobuild_test_"))
console.print(f" Created temp directory: {self.temp_dir}")
# Create subdirectories
@@ -137,7 +147,7 @@
)
# Save config to disk for CLI to use
- from archbuild.config import save_config
+ from archrepobuild.config import save_config
self.config_path = self.temp_dir / "config.yaml"
save_config(self.config, self.config_path)
@@ -280,7 +290,7 @@
if artifacts:
# Create a mock build result for add_packages
- from archbuild.builder import BuildResult
+ from archrepobuild.builder import BuildResult
mock_result = BuildResult(
package=pkg_name,
status=BuildStatus.SUCCESS,
@@ -345,7 +355,12 @@
async def run(self) -> bool:
"""Run all integration tests."""
- mode_str = " (CLI Mode)" if self.use_cli else " (Python Mode)"
+ mode_str = " (Python Mode)"
+ if self.use_binary:
+ mode_str = " (Binary Mode)"
+ elif self.use_cli:
+ mode_str = " (CLI Mode)"
+
console.print("[bold magenta]╔════════════════════════════════════════════╗[/]")
console.print(f"[bold magenta]║ Archbuild Integration Test Suite{mode_str:<10}║[/]")
console.print("[bold magenta]╚════════════════════════════════════════════╝[/]")
@@ -401,6 +416,10 @@
"""Main entry point."""
keep_temp = "--keep-temp" in sys.argv
use_cli = "--use-cli" in sys.argv
+ use_binary = "--use-binary" in sys.argv
+
+ if use_binary:
+ use_cli = True # Binary mode is a sub-mode of CLI mode
# Check if running on Arch Linux
if not Path("/etc/arch-release").exists():
@@ -414,7 +433,7 @@
console.print(f"[red]Required tool not found: {tool}[/]")
return 1
- test = IntegrationTest(keep_temp=keep_temp, use_cli=use_cli)
+ test = IntegrationTest(keep_temp=keep_temp, use_cli=use_cli, use_binary=use_binary)
success = await test.run()
return 0 if success else 1
--
Gitblit v1.10.0