mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 08:56:35 +00:00
Refactor configuration and update test structure for improved clarity
- Updated `.gitignore` to remove committed test fixture data exclusions. - Increased batch size in `config.test.yaml` from 4 to 128 for training. - Simplified directory structure in `config.yaml` by removing unnecessary data paths. - Adjusted paths in `augmentation.py`, `dataset-visualiser.py`, and `exports.py` to align with the new configuration structure. - Enhanced `annotation_queue_handler.py` to utilize the updated configuration for directory management. - Added CSV logging of test results in `conftest.py` for better test reporting. These changes streamline the configuration management and enhance the testing framework, ensuring better organization and clarity in the project.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import csv
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
@@ -14,6 +15,34 @@ _CONFIG_TEST = _PROJECT_ROOT / "config.test.yaml"
|
||||
|
||||
collect_ignore = ["security_test.py", "imagelabel_visualize_test.py"]
|
||||
|
||||
_test_results = []
|
||||
|
||||
|
||||
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
|
||||
def pytest_runtest_makereport(item, call):
|
||||
outcome = yield
|
||||
report = outcome.get_result()
|
||||
if report.when == "call" or (report.when == "setup" and report.skipped):
|
||||
_test_results.append({
|
||||
"module": item.nodeid.rsplit("::", 1)[0],
|
||||
"name": item.name,
|
||||
"result": report.outcome.upper(),
|
||||
"duration": round(report.duration, 3),
|
||||
})
|
||||
|
||||
|
||||
def pytest_sessionfinish(session, exitstatus):
|
||||
if not _test_results:
|
||||
return
|
||||
results_dir = Path(__file__).resolve().parent / "test-results"
|
||||
results_dir.mkdir(exist_ok=True)
|
||||
|
||||
with open(results_dir / "test-results.csv", "w", newline="", encoding="utf-8") as f:
|
||||
writer = csv.writer(f)
|
||||
writer.writerow(["module", "test", "result", "duration_s"])
|
||||
for r in _test_results:
|
||||
writer.writerow([r["module"], r["name"], r["result"], f"{r['duration']:.3f}"])
|
||||
|
||||
|
||||
def apply_constants_patch(monkeypatch, base: Path):
|
||||
import constants as c
|
||||
|
||||
Reference in New Issue
Block a user