mirror of
https://github.com/trustedsec/hate_crack.git
synced 2026-07-30 15:40:31 -07:00
fix: skip ML-dependent tests in CI and mock version in version check test
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
2667b0396c
commit
c87f498c80
@@ -1,9 +1,12 @@
|
||||
import importlib.util
|
||||
import os
|
||||
import sys
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
_has_transformers = importlib.util.find_spec("transformers") is not None
|
||||
|
||||
from hate_crack.passgpt_train import (
|
||||
_count_lines,
|
||||
_estimate_training_memory_mb,
|
||||
@@ -395,6 +398,7 @@ class TestMemoryPrecheck:
|
||||
device="cpu",
|
||||
)
|
||||
|
||||
@pytest.mark.skipif(not _has_transformers, reason="transformers not installed")
|
||||
def test_skips_when_detection_fails(self, tmp_path):
|
||||
"""When memory detection returns None, training proceeds past the pre-check."""
|
||||
f = tmp_path / "words.txt"
|
||||
@@ -456,6 +460,7 @@ class TestMaxLines:
|
||||
|
||||
|
||||
class TestMemoryLimitAutoTune:
|
||||
@pytest.mark.skipif(not _has_transformers, reason="transformers not installed")
|
||||
def test_auto_tunes_max_lines(self, tmp_path, capsys):
|
||||
f = tmp_path / "words.txt"
|
||||
f.write_text("password\n" * 100)
|
||||
|
||||
Reference in New Issue
Block a user