mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-23 01:56:35 +00:00
Update test results directory structure and enhance Docker configurations
- Modified `.gitignore` to reflect the new path for test results. - Updated `docker-compose.test.yml` to mount the correct test results directory. - Adjusted `Dockerfile.test` to set the `PYTHONPATH` and ensure test results are saved in the updated location. - Added `boto3` and `netron` to `requirements-test.txt` to support new functionalities. - Updated `pytest.ini` to include the new `pythonpath` for test discovery. These changes streamline the testing process and ensure compatibility with the updated directory structure.
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import shutil
|
||||
import sys
|
||||
import time
|
||||
import types
|
||||
from os import path as osp
|
||||
from pathlib import Path
|
||||
|
||||
@@ -10,40 +8,6 @@ import pytest
|
||||
import constants as c_mod
|
||||
|
||||
|
||||
def _stub_train_dependencies():
|
||||
if getattr(_stub_train_dependencies, "_done", False):
|
||||
return
|
||||
|
||||
def add_mod(name):
|
||||
if name in sys.modules:
|
||||
return sys.modules[name]
|
||||
m = types.ModuleType(name)
|
||||
sys.modules[name] = m
|
||||
return m
|
||||
|
||||
ultra = add_mod("ultralytics")
|
||||
|
||||
class YOLO:
|
||||
pass
|
||||
|
||||
ultra.YOLO = YOLO
|
||||
|
||||
def fake_client(*_a, **_k):
|
||||
return types.SimpleNamespace(
|
||||
upload_fileobj=lambda *_a, **_k: None,
|
||||
download_file=lambda *_a, **_k: None,
|
||||
)
|
||||
|
||||
boto = add_mod("boto3")
|
||||
boto.client = fake_client
|
||||
add_mod("netron")
|
||||
add_mod("requests")
|
||||
_stub_train_dependencies._done = True
|
||||
|
||||
|
||||
_stub_train_dependencies()
|
||||
|
||||
|
||||
def _prepare_form_dataset(
|
||||
monkeypatch,
|
||||
tmp_path,
|
||||
@@ -82,6 +46,7 @@ def test_pt_dsf_01_dataset_formation_under_thirty_seconds(
|
||||
fixture_images_dir,
|
||||
fixture_labels_dir,
|
||||
):
|
||||
# Arrange
|
||||
train, today_ds = _prepare_form_dataset(
|
||||
monkeypatch,
|
||||
tmp_path,
|
||||
@@ -91,7 +56,9 @@ def test_pt_dsf_01_dataset_formation_under_thirty_seconds(
|
||||
100,
|
||||
set(),
|
||||
)
|
||||
# Act
|
||||
t0 = time.perf_counter()
|
||||
train.form_dataset()
|
||||
elapsed = time.perf_counter() - t0
|
||||
# Assert
|
||||
assert elapsed <= 30.0
|
||||
|
||||
Reference in New Issue
Block a user