From f80dfcee4e13c29370b23e2c428ab3fb54c16660 Mon Sep 17 00:00:00 2001 From: Justin Bollinger Date: Thu, 19 Mar 2026 23:42:43 -0400 Subject: [PATCH] fix: add skip guards for missing runtime artifacts in e2e/integration tests --- tests/test_markov_e2e.py | 7 ++++++- tests/test_pipal_integration.py | 7 +++---- tests/test_upload_wordlist.py | 2 ++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/test_markov_e2e.py b/tests/test_markov_e2e.py index 7ee8e7e..a302876 100644 --- a/tests/test_markov_e2e.py +++ b/tests/test_markov_e2e.py @@ -1,6 +1,5 @@ """End-to-end tests for markov brute force attack flow.""" -import os import gzip from pathlib import Path from unittest.mock import MagicMock, patch @@ -18,6 +17,9 @@ class TestMarkovE2E: # Setup paths main.hate_path = Path(__file__).resolve().parents[1] main.hcatHcstat2genBin = "hcstat2gen.bin" + bin_path = main.hate_path / "hashcat-utils" / "bin" / "hcstat2gen.bin" + if not bin_path.is_file(): + pytest.skip(f"hcstat2gen.bin not compiled: {bin_path}") # Create test wordlist wordlist = tmp_path / "wordlist.txt" @@ -44,6 +46,9 @@ class TestMarkovE2E: # Setup paths main.hate_path = Path(__file__).resolve().parents[1] main.hcatHcstat2genBin = "hcstat2gen.bin" + bin_path = main.hate_path / "hashcat-utils" / "bin" / "hcstat2gen.bin" + if not bin_path.is_file(): + pytest.skip(f"hcstat2gen.bin not compiled: {bin_path}") # Create test wordlist (gzipped) wordlist_plain = tmp_path / "wordlist.txt" diff --git a/tests/test_pipal_integration.py b/tests/test_pipal_integration.py index 61cf0de..3778971 100644 --- a/tests/test_pipal_integration.py +++ b/tests/test_pipal_integration.py @@ -1,19 +1,18 @@ import os import subprocess - - import json +import pytest def test_pipal_executable_and_runs(tmp_path): # Read pipalPath from config.json config_path = os.path.join(os.path.dirname(__file__), "..", "config.json") + if not os.path.isfile(config_path): + pytest.skip("config.json not present (worktree or fresh checkout)") with open(config_path, "r") as f: config = json.load(f) pipal_path = config.get("pipalPath") if not pipal_path or not os.path.isfile(pipal_path): - import pytest - pytest.skip("pipalPath not configured or file missing") if not os.access(pipal_path, os.X_OK): diff --git a/tests/test_upload_wordlist.py b/tests/test_upload_wordlist.py index c77fb9f..7912ef5 100644 --- a/tests/test_upload_wordlist.py +++ b/tests/test_upload_wordlist.py @@ -7,6 +7,8 @@ from hate_crack.api import HashviewAPI def get_hashview_config(): config_path = os.path.join(os.path.dirname(__file__), "..", "config.json") + if not os.path.isfile(config_path): + pytest.skip("config.json not present (worktree or fresh checkout)") with open(config_path, "r") as f: config = json.load(f) hashview_url = config.get("hashview_url")