From 518015d5deae5b6d9d7a06f459807bba81405908 Mon Sep 17 00:00:00 2001 From: Jintao Lin Date: Thu, 16 Jul 2020 16:33:44 +0800 Subject: [PATCH] Reorganize Unittest structure (#26) * migrate unittest files * move test_common_modules to test_models/ --- tests/{ => test_data}/test_augmentations.py | 0 tests/{ => test_data}/test_compose.py | 0 tests/{ => test_data}/test_dataset.py | 2 +- tests/{ => test_data}/test_formating.py | 0 tests/{ => test_data}/test_loading.py | 16 ++++++++++------ tests/{ => test_models}/test_backbone.py | 0 tests/{ => test_models}/test_common_modules.py | 0 tests/{ => test_models}/test_head.py | 0 tests/{ => test_models}/test_inference.py | 0 tests/{ => test_models}/test_localizers.py | 0 tests/{ => test_models}/test_recognizers.py | 2 +- 11 files changed, 12 insertions(+), 8 deletions(-) rename tests/{ => test_data}/test_augmentations.py (100%) rename tests/{ => test_data}/test_compose.py (100%) rename tests/{ => test_data}/test_dataset.py (99%) rename tests/{ => test_data}/test_formating.py (100%) rename tests/{ => test_data}/test_loading.py (98%) rename tests/{ => test_models}/test_backbone.py (100%) rename tests/{ => test_models}/test_common_modules.py (100%) rename tests/{ => test_models}/test_head.py (100%) rename tests/{ => test_models}/test_inference.py (100%) rename tests/{ => test_models}/test_localizers.py (100%) rename tests/{ => test_models}/test_recognizers.py (99%) diff --git a/tests/test_augmentations.py b/tests/test_data/test_augmentations.py similarity index 100% rename from tests/test_augmentations.py rename to tests/test_data/test_augmentations.py diff --git a/tests/test_compose.py b/tests/test_data/test_compose.py similarity index 100% rename from tests/test_compose.py rename to tests/test_data/test_compose.py diff --git a/tests/test_dataset.py b/tests/test_data/test_dataset.py similarity index 99% rename from tests/test_dataset.py rename to tests/test_data/test_dataset.py index 79255b8bdf..24dde773ce 100644 --- a/tests/test_dataset.py +++ b/tests/test_data/test_dataset.py @@ -20,7 +20,7 @@ def check_keys_contain(result_keys, target_keys): @classmethod def setup_class(cls): - cls.data_prefix = osp.join(osp.dirname(__file__), 'data') + cls.data_prefix = osp.join(osp.dirname(osp.dirname(__file__)), 'data') cls.frame_ann_file = osp.join(cls.data_prefix, 'frame_test_list.txt') cls.video_ann_file = osp.join(cls.data_prefix, 'video_test_list.txt') cls.action_ann_file = osp.join(cls.data_prefix, diff --git a/tests/test_formating.py b/tests/test_data/test_formating.py similarity index 100% rename from tests/test_formating.py rename to tests/test_data/test_formating.py diff --git a/tests/test_loading.py b/tests/test_data/test_loading.py similarity index 98% rename from tests/test_loading.py rename to tests/test_data/test_loading.py index 3e03787167..8e3da593e2 100644 --- a/tests/test_loading.py +++ b/tests/test_data/test_loading.py @@ -23,15 +23,19 @@ def check_keys_contain(result_keys, target_keys): @classmethod def setup_class(cls): - cls.img_path = osp.join(osp.dirname(__file__), 'data/test.jpg') - cls.video_path = osp.join(osp.dirname(__file__), 'data/test.mp4') - cls.img_dir = osp.join(osp.dirname(__file__), 'data/test_imgs') + cls.img_path = osp.join( + osp.dirname(osp.dirname(__file__)), 'data/test.jpg') + cls.video_path = osp.join( + osp.dirname(osp.dirname(__file__)), 'data/test.mp4') + cls.img_dir = osp.join( + osp.dirname(osp.dirname(__file__)), 'data/test_imgs') cls.raw_feature_dir = osp.join( - osp.dirname(__file__), 'data/test_activitynet_features') + osp.dirname(osp.dirname(__file__)), + 'data/test_activitynet_features') cls.bsp_feature_dir = osp.join( - osp.dirname(__file__), 'data/test_bsp_features') + osp.dirname(osp.dirname(__file__)), 'data/test_bsp_features') cls.proposals_dir = osp.join( - osp.dirname(__file__), 'data/test_proposals') + osp.dirname(osp.dirname(__file__)), 'data/test_proposals') cls.total_frames = 5 cls.filename_tmpl = 'img_{:05}.jpg' cls.flow_filename_tmpl = '{}_{:05d}.jpg' diff --git a/tests/test_backbone.py b/tests/test_models/test_backbone.py similarity index 100% rename from tests/test_backbone.py rename to tests/test_models/test_backbone.py diff --git a/tests/test_common_modules.py b/tests/test_models/test_common_modules.py similarity index 100% rename from tests/test_common_modules.py rename to tests/test_models/test_common_modules.py diff --git a/tests/test_head.py b/tests/test_models/test_head.py similarity index 100% rename from tests/test_head.py rename to tests/test_models/test_head.py diff --git a/tests/test_inference.py b/tests/test_models/test_inference.py similarity index 100% rename from tests/test_inference.py rename to tests/test_models/test_inference.py diff --git a/tests/test_localizers.py b/tests/test_models/test_localizers.py similarity index 100% rename from tests/test_localizers.py rename to tests/test_models/test_localizers.py diff --git a/tests/test_recognizers.py b/tests/test_models/test_recognizers.py similarity index 99% rename from tests/test_recognizers.py rename to tests/test_models/test_recognizers.py index 153db58993..9ca9a68fc2 100644 --- a/tests/test_recognizers.py +++ b/tests/test_models/test_recognizers.py @@ -33,7 +33,7 @@ def _get_recognizer_cfg(fname): These are deep copied to allow for safe modification of parameters without influencing other tests. """ - repo_dpath = osp.dirname(osp.dirname(__file__)) + repo_dpath = osp.dirname(osp.dirname(osp.dirname(__file__))) config_dpath = osp.join(repo_dpath, 'configs/recognition') config_fpath = osp.join(config_dpath, fname) if not osp.exists(config_dpath):