Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MiXaiLL76 committed Oct 9, 2024
1 parent a7162f8 commit 5a81428
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
CIBW_FREE_THREADED_SUPPORT: true
CIBW_SKIP: "pp* *musllinux* *cp36* *cp313*"
CIBW_ARCHS: x86_64
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_REQUIRES: "pytest parameterized"
CIBW_TEST_COMMAND: "cd {project}/tests && pytest ."
with:
package-dir: ./
Expand Down
15 changes: 13 additions & 2 deletions tests/test_coco_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@

import numpy as np
from parameterized import parameterized
from pycocotools.coco import COCO as origCOCO
from pycocotools.cocoeval import COCOeval as origCOCOeval

try:
from pycocotools.coco import COCO as origCOCO
from pycocotools.cocoeval import COCOeval as origCOCOeval
except ImportError:
origCOCO = None
origCOCOeval = None

import faster_coco_eval.core.mask as mask_util
from faster_coco_eval import COCO, COCOeval_faster
Expand Down Expand Up @@ -136,6 +141,9 @@ def tearDown(self):

@parameterized.expand([(COCO, COCOeval_faster), (origCOCO, origCOCOeval)])
def test_evaluate(self, coco_cls, cocoeval_cls):
if coco_cls is None:
raise unittest.SkipTest("Skipping pycocotools test.")

# create dummy data
fake_json_file = osp.join(self.tmp_dir.name, "fake_data.json")
self._create_dummy_coco_json(fake_json_file)
Expand Down Expand Up @@ -190,6 +198,9 @@ def test_evaluate(self, coco_cls, cocoeval_cls):

@parameterized.expand([(COCO, COCOeval_faster), (origCOCO, origCOCOeval)])
def test_detectron2_eval(self, coco_cls, cocoeval_cls):
if coco_cls is None:
raise unittest.SkipTest("Skipping pycocotools test.")

# https://github.com/facebookresearch/detectron2/blob/main/tests/data/test_coco_evaluation.py
# A small set of images/categories from COCO val
# fmt: off
Expand Down
12 changes: 10 additions & 2 deletions tests/test_keypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
from unittest import TestCase

from parameterized import parameterized
from pycocotools.coco import COCO as origCOCO
from pycocotools.cocoeval import COCOeval as origCOCOeval

try:
from pycocotools.coco import COCO as origCOCO
from pycocotools.cocoeval import COCOeval as origCOCOeval
except ImportError:
origCOCO = None
origCOCOeval = None

from faster_coco_eval import COCO, COCOeval_faster

Expand Down Expand Up @@ -32,6 +37,9 @@ def setUp(self):

@parameterized.expand([(COCO, COCOeval_faster), (origCOCO, origCOCOeval)])
def test_evaluate(self, coco_cls, cocoeval_cls):
if coco_cls is None:
raise unittest.SkipTest("Skipping pycocotools test.")

cocoGt = coco_cls(self.gt_file)
cocoGt.info()

Expand Down

0 comments on commit 5a81428

Please sign in to comment.