mirror of
https://github.com/trustedsec/hate_crack.git
synced 2026-04-28 12:03:11 -07:00
23 lines
624 B
Python
23 lines
624 B
Python
import importlib.util
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
|
|
def load_hate_crack_module(monkeypatch):
|
|
monkeypatch.setenv("HATE_CRACK_SKIP_INIT", "1")
|
|
module_path = Path(__file__).resolve().parents[1] / "hate_crack.py"
|
|
module_name = "hate_crack_script"
|
|
if module_name in sys.modules:
|
|
del sys.modules[module_name]
|
|
spec = importlib.util.spec_from_file_location(module_name, module_path)
|
|
module = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(module)
|
|
return module
|
|
|
|
|
|
@pytest.fixture
|
|
def hc_module(monkeypatch):
|
|
return load_hate_crack_module(monkeypatch)
|