Skip to content

Commit

Permalink
Remove mm in tests/conftest (#3618)
Browse files Browse the repository at this point in the history
* Remove mm in tests/conftest

* Add decord dependency

* Fix mmengine imports

* Revert action intg test
  • Loading branch information
harimkang authored Jun 18, 2024
1 parent 2de7332 commit f732ab3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 30 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ dependencies = [
"docstring_parser==0.16", # CLI help-formatter
"rich_argparse==1.4.0", # CLI help-formatter
"einops==0.7.0",
"decord==0.6.0",
]

[project.optional-dependencies]
Expand Down
4 changes: 3 additions & 1 deletion src/otx/core/data/transform_libs/torchvision.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import torchvision.transforms.v2 as tvt_v2
from datumaro.components.media import Video
from lightning.pytorch.cli import instantiate_class
from mmengine.fileio import FileClient
from numpy import random
from omegaconf import DictConfig
from torchvision import tv_tensors
Expand Down Expand Up @@ -2725,6 +2724,9 @@ def __init__(self, io_backend: str = "disk", num_threads: int = 1, **kwargs) ->

def _get_video_reader(self, filename: str) -> decord.VideoReader:
if self.file_client is None:
# TODO(wonjulee): Remove mmengine imports
from mmengine.fileio import FileClient

self.file_client = FileClient(self.io_backend, **self.kwargs)
file_obj = io.BytesIO(self.file_client.get(filename))
return decord.VideoReader(file_obj, num_threads=self.num_threads)
Expand Down
20 changes: 0 additions & 20 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import pytest
import torch
from datumaro import Polygon
from mmdet.structures import DetDataSample
from otx.algo.utils.mmengine_utils import InstanceData
from otx.core.data.entity.base import ImageInfo
from otx.core.data.entity.classification import (
HlabelClsBatchDataEntity,
Expand Down Expand Up @@ -141,24 +139,6 @@ def pytest_addoption(parser: pytest.Parser):
)


@pytest.fixture(scope="session")
def fxt_data_sample() -> list[DetDataSample]:
data_sample = DetDataSample(
metainfo={
"img_shape": (480, 480),
"ori_shape": (480, 480),
"scale_factor": (1.0, 1.0),
"pad_shape": (480, 480),
"ignored_labels": [],
},
gt_instances=InstanceData(
bboxes=torch.Tensor([[0.0, 0.0, 240, 240], [240, 240, 480, 480]]),
labels=torch.LongTensor([0, 1]),
),
)
return [data_sample]


@pytest.fixture(scope="session")
def fxt_multi_class_cls_data_entity() -> (
tuple[MulticlassClsDataEntity, MulticlassClsBatchDataEntity, MulticlassClsBatchDataEntity]
Expand Down
8 changes: 0 additions & 8 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from pathlib import Path

import pytest
from mmengine.config import Config as MMConfig
from otx.core.types.task import OTXTaskType


Expand Down Expand Up @@ -95,13 +94,6 @@ def fxt_asset_dir() -> Path:
return Path(__file__).parent.parent / "assets"


@pytest.fixture(scope="session")
def fxt_rtmdet_tiny_config(fxt_asset_dir: Path) -> MMConfig:
config_path = fxt_asset_dir / "mmdet_configs" / "rtmdet_tiny_8xb32-300e_coco.py"

return MMConfig.fromfile(config_path)


# [TODO]: This is a temporary approach.
@pytest.fixture(scope="module")
def fxt_target_dataset_per_task() -> dict:
Expand Down
12 changes: 11 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ commands =
{posargs}


[testenv:integration-test-{all, action, classification, detection, rotated_detection, instance_segmentation, semantic_segmentation, visual_prompting, anomaly}]
; [TODO]: Revisit after resolving https://jira.devtools.intel.com/browse/CVS-143479
[testenv:integration-test-{all, action, detection}]
setenv =
CUBLAS_WORKSPACE_CONFIG=:4096:8
deps =
Expand All @@ -61,6 +62,15 @@ commands =
python -m pytest tests/integration -ra --showlocals --csv={toxworkdir}/{envname}.csv --task {[testenv]task} --open-subprocess {posargs}


[testenv:integration-test-{classification, rotated_detection, instance_segmentation, semantic_segmentation, visual_prompting, anomaly}]
setenv =
CUBLAS_WORKSPACE_CONFIG=:4096:8
deps =
.[base,dev]
commands =
python -m pytest tests/integration -ra --showlocals --csv={toxworkdir}/{envname}.csv --task {[testenv]task} --open-subprocess {posargs}


[testenv:e2e-test-{all, action, classification, detection, rotated_detection, instance_segmentation, semantic_segmentation, visual_prompting, anomaly}]
setenv =
CUBLAS_WORKSPACE_CONFIG=:4096:8
Expand Down

0 comments on commit f732ab3

Please sign in to comment.