Skip to content

Commit

Permalink
[Fix]: Fix sampler unit test. (open-mmlab#6284)
Browse files Browse the repository at this point in the history
  • Loading branch information
RangiLyu authored Oct 15, 2021
1 parent 1a90fa8 commit 78e3ec8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion tests/test_data/test_datasets/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ def _create_dummy_results():
@pytest.mark.parametrize('config_path',
['./configs/_base_/datasets/voc0712.py'])
def test_dataset_init(config_path):
use_symlink = False
if not os.path.exists('./data'):
os.symlink('./tests/data', './data')
use_symlink = True
data_config = mmcv.Config.fromfile(config_path)
if 'data' not in data_config:
return
Expand All @@ -115,7 +117,8 @@ def test_dataset_init(config_path):
dataset_config = copy.deepcopy(data_config.data.get(stage_name))
dataset = build_dataset(dataset_config)
dataset[0]
os.unlink('./data')
if use_symlink:
os.unlink('./data')


def test_dataset_evaluation():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_data/test_pipelines/test_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _context_for_ohem():
import sys
from os.path import dirname
sys.path.insert(0, dirname(dirname(dirname(__file__))))
from test_forward import _get_detector_cfg
from test_models.test_forward import _get_detector_cfg

model = _get_detector_cfg(
'faster_rcnn/faster_rcnn_r50_fpn_ohem_1x_coco.py')
Expand Down

0 comments on commit 78e3ec8

Please sign in to comment.