Skip to content

Commit

Permalink
Added --only-local to pytest (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
kozlov721 authored Dec 4, 2024
1 parent 99fa917 commit c90f716
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 31 deletions.
23 changes: 23 additions & 0 deletions tests/test_data/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from pytest import Metafunc, Parser

from luxonis_ml.data import BucketStorage


def pytest_addoption(parser: Parser):
parser.addoption(
"--only-local",
action="store_true",
default=False,
help="Run tests only for local storage",
)


def pytest_generate_tests(metafunc: Metafunc):
if "bucket_storage" in metafunc.fixturenames:
only_local = metafunc.config.getoption("--only-local")
storage_options = (
[BucketStorage.LOCAL]
if only_local
else [BucketStorage.LOCAL, BucketStorage.S3, BucketStorage.GCS]
)
metafunc.parametrize("bucket_storage", storage_options)
22 changes: 0 additions & 22 deletions tests/test_data/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,6 @@ def make_image(i) -> Path:
return path


@pytest.mark.parametrize(
("bucket_storage",),
[
(BucketStorage.LOCAL,),
(BucketStorage.S3,),
(BucketStorage.GCS,),
],
)
def test_dataset(
bucket_storage: BucketStorage,
platform_name: str,
Expand Down Expand Up @@ -214,13 +206,6 @@ def _raise(*_):
_ = loader[0]


@pytest.mark.parametrize(
("bucket_storage",),
[
(BucketStorage.LOCAL,),
(BucketStorage.GCS,),
],
)
def test_make_splits(
bucket_storage: BucketStorage, platform_name: str, python_version: str
):
Expand Down Expand Up @@ -519,13 +504,6 @@ def generator():
}


@pytest.mark.parametrize(
("bucket_storage",),
[
(BucketStorage.LOCAL,),
(BucketStorage.GCS,),
],
)
def test_uncommon_label_types(
bucket_storage: BucketStorage, platform_name: str, python_version: str
):
Expand Down
8 changes: 0 additions & 8 deletions tests/test_data/test_task_ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ def compute_histogram(dataset: LuxonisDataset) -> Dict[str, int]:
return dict(classes)


@pytest.mark.parametrize(
("bucket_storage",),
[
(BucketStorage.LOCAL,),
(BucketStorage.S3,),
(BucketStorage.GCS,),
],
)
def test_task_ingestion(
bucket_storage: BucketStorage, platform_name: str, python_version: str
):
Expand Down
4 changes: 3 additions & 1 deletion tests/test_utils/test_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ def get_os_python_specific_url(


@pytest.fixture
def fs(request, python_version: str, platform_name: str):
def fs(
request: pytest.FixtureRequest, python_version: str, platform_name: str
):
url_path = get_os_python_specific_url(
request.param, platform_name, python_version
)
Expand Down

0 comments on commit c90f716

Please sign in to comment.