mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 17:46:41 +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,9 +1,7 @@
|
||||
import concurrent.futures
|
||||
import random
|
||||
import shutil
|
||||
import sys
|
||||
import time
|
||||
import types
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
@@ -11,13 +9,6 @@ import pytest
|
||||
|
||||
from tests.conftest import apply_constants_patch
|
||||
|
||||
if "matplotlib" not in sys.modules:
|
||||
_mpl = types.ModuleType("matplotlib")
|
||||
_plt = types.ModuleType("matplotlib.pyplot")
|
||||
_mpl.pyplot = _plt
|
||||
sys.modules["matplotlib"] = _mpl
|
||||
sys.modules["matplotlib.pyplot"] = _plt
|
||||
|
||||
|
||||
def _patch_augmentation_paths(monkeypatch, base: Path):
|
||||
apply_constants_patch(monkeypatch, base)
|
||||
@@ -44,6 +35,7 @@ def _seed():
|
||||
def test_pt_aug_01_throughput_ten_images_sixty_seconds(
|
||||
tmp_path, monkeypatch, sample_images_labels
|
||||
):
|
||||
# Arrange
|
||||
_patch_augmentation_paths(monkeypatch, tmp_path)
|
||||
_augment_annotation_with_total(monkeypatch)
|
||||
_seed()
|
||||
@@ -59,9 +51,11 @@ def test_pt_aug_01_throughput_ten_images_sixty_seconds(
|
||||
shutil.copy2(p, img_dir / p.name)
|
||||
for p in src_lbl.glob("*.txt"):
|
||||
shutil.copy2(p, lbl_dir / p.name)
|
||||
# Act
|
||||
t0 = time.perf_counter()
|
||||
Augmentator().augment_annotations()
|
||||
elapsed = time.perf_counter() - t0
|
||||
# Assert
|
||||
assert elapsed <= 60.0
|
||||
|
||||
|
||||
@@ -69,6 +63,7 @@ def test_pt_aug_01_throughput_ten_images_sixty_seconds(
|
||||
def test_pt_aug_02_parallel_at_least_one_point_five_x_faster(
|
||||
tmp_path, monkeypatch, sample_images_labels
|
||||
):
|
||||
# Arrange
|
||||
_patch_augmentation_paths(monkeypatch, tmp_path)
|
||||
_augment_annotation_with_total(monkeypatch)
|
||||
_seed()
|
||||
@@ -97,6 +92,7 @@ def test_pt_aug_02_parallel_at_least_one_point_five_x_faster(
|
||||
|
||||
entries = [_E(n) for n in names]
|
||||
|
||||
# Act
|
||||
aug_seq = Augmentator()
|
||||
aug_seq.total_images_to_process = len(entries)
|
||||
t0 = time.perf_counter()
|
||||
@@ -115,4 +111,5 @@ def test_pt_aug_02_parallel_at_least_one_point_five_x_faster(
|
||||
list(ex.map(aug_par.augment_annotation, entries))
|
||||
par_elapsed = time.perf_counter() - t0
|
||||
|
||||
# Assert
|
||||
assert seq_elapsed >= par_elapsed * 1.5
|
||||
|
||||
Reference in New Issue
Block a user