diff --git a/.flake8 b/.flake8 index 0ba73e9..95f9808 100644 --- a/.flake8 +++ b/.flake8 @@ -1,6 +1,3 @@ [flake8] exclude = .git, .venv, output, static/icons max-line-length = 160 -per-file-ignores = - tests/test_*.py: E402 - diff --git a/tests/test_analyze.py b/tests/test_analyze.py index 138e73d..6e97ab6 100644 --- a/tests/test_analyze.py +++ b/tests/test_analyze.py @@ -1,12 +1,6 @@ -import sys import json import sqlite3 from pathlib import Path - -import pytest # noqa: F401 - -REPO_ROOT = Path(__file__).resolve().parents[1] -sys.path.append(str(REPO_ROOT)) from scripts import analyze from scripts import generate_reports as gr diff --git a/tests/test_nginx_config.py b/tests/test_nginx_config.py index b2b1317..604b700 100644 --- a/tests/test_nginx_config.py +++ b/tests/test_nginx_config.py @@ -1,9 +1,5 @@ -import sys from pathlib import Path -import pytest # noqa: F401 -REPO_ROOT = Path(__file__).resolve().parents[1] -sys.path.append(str(REPO_ROOT)) from scripts import nginx_config as nc diff --git a/tests/test_reports.py b/tests/test_reports.py index fa8f0a0..f6c6918 100644 --- a/tests/test_reports.py +++ b/tests/test_reports.py @@ -1,14 +1,10 @@ import sqlite3 from pathlib import Path import json -import sys from datetime import datetime import pytest from typer.testing import CliRunner - -REPO_ROOT = Path(__file__).resolve().parents[1] -sys.path.append(str(REPO_ROOT)) from scripts import generate_reports as gr @@ -205,7 +201,9 @@ def test_generate_root_index(tmp_path, sample_reports, monkeypatch): def test_generated_marker_written(tmp_path, monkeypatch): out_dir = tmp_path / "output" monkeypatch.setattr(gr, "OUTPUT_DIR", out_dir) - monkeypatch.setattr(gr, "TEMPLATE_DIR", REPO_ROOT / "templates") + monkeypatch.setattr( + gr, "TEMPLATE_DIR", Path(__file__).resolve().parents[1] / "templates" + ) monkeypatch.setattr(gr, "GENERATED_MARKER", out_dir / "generated.txt") monkeypatch.setattr(gr, "_copy_icons", lambda: None) (out_dir / "hourly").mkdir(parents=True)