mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 08: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,39 +1,40 @@
|
||||
import sys
|
||||
import types
|
||||
|
||||
for _name in ("ultralytics", "boto3", "netron", "requests"):
|
||||
if _name not in sys.modules:
|
||||
sys.modules[_name] = types.ModuleType(_name)
|
||||
sys.modules["ultralytics"].YOLO = type("YOLO", (), {})
|
||||
sys.modules["boto3"].client = lambda *a, **k: None
|
||||
|
||||
from train import check_label
|
||||
|
||||
|
||||
def test_bt_lbl_01_valid_label_returns_true(tmp_path):
|
||||
# Arrange
|
||||
p = tmp_path / "a.txt"
|
||||
p.write_text("0 0.5 0.5 0.1 0.1", encoding="utf-8")
|
||||
# Assert
|
||||
assert check_label(str(p)) is True
|
||||
|
||||
|
||||
def test_bt_lbl_02_x_gt_one_returns_false(tmp_path):
|
||||
# Arrange
|
||||
p = tmp_path / "a.txt"
|
||||
p.write_text("0 1.5 0.5 0.1 0.1", encoding="utf-8")
|
||||
# Assert
|
||||
assert check_label(str(p)) is False
|
||||
|
||||
|
||||
def test_bt_lbl_03_height_gt_one_returns_false(tmp_path):
|
||||
# Arrange
|
||||
p = tmp_path / "a.txt"
|
||||
p.write_text("0 0.5 0.5 0.1 1.2", encoding="utf-8")
|
||||
# Assert
|
||||
assert check_label(str(p)) is False
|
||||
|
||||
|
||||
def test_bt_lbl_04_missing_file_returns_false(tmp_path):
|
||||
# Arrange
|
||||
p = tmp_path / "missing.txt"
|
||||
# Assert
|
||||
assert check_label(str(p)) is False
|
||||
|
||||
|
||||
def test_bt_lbl_05_multiline_one_corrupted_returns_false(tmp_path):
|
||||
# Arrange
|
||||
p = tmp_path / "a.txt"
|
||||
p.write_text("0 0.5 0.5 0.1 0.1\n3 0.5 0.5 0.1 1.5", encoding="utf-8")
|
||||
# Assert
|
||||
assert check_label(str(p)) is False
|
||||
|
||||
Reference in New Issue
Block a user