5
5
6
6
from mmengine .config .collect_meta import (_get_external_cfg_base_path ,
7
7
_parse_external_cfg_path ,
8
- _parse_rel_cfg_path )
8
+ _parse_cfg_name )
9
9
10
10
11
11
def test_get_external_cfg_base_path (tmp_path ):
12
12
package_path = tmp_path
13
13
rel_cfg_path = 'cfg_dir/cfg_file'
14
14
with pytest .raises (FileNotFoundError ):
15
15
_get_external_cfg_base_path (str (package_path ), rel_cfg_path )
16
- cfg_dir = tmp_path / '.mmengine ' / 'configs' / 'cfg_dir'
16
+ cfg_dir = tmp_path / '.mim ' / 'configs' / 'cfg_dir'
17
17
cfg_dir .mkdir (parents = True , exist_ok = True )
18
18
f = open (cfg_dir / 'cfg_file' , 'w' )
19
19
f .close ()
@@ -22,20 +22,20 @@ def test_get_external_cfg_base_path(tmp_path):
22
22
23
23
24
24
def test_parse_external_cfg_path ():
25
- external_cfg_path = 'package ::path/cfg'
25
+ external_cfg_path = 'mmdet ::path/cfg'
26
26
package , rel_cfg_path = _parse_external_cfg_path (external_cfg_path )
27
- assert package == 'package '
27
+ assert package == 'mmdet '
28
28
assert rel_cfg_path == 'path/cfg'
29
29
# external config must contain `::`.
30
30
external_cfg_path = 'path/cfg'
31
31
with pytest .raises (ValueError ):
32
32
_parse_external_cfg_path (external_cfg_path )
33
33
# Use `:::` as operator will raise an error.
34
- external_cfg_path = 'package :::path/cfg'
34
+ external_cfg_path = 'mmdet :::path/cfg'
35
35
with pytest .raises (ValueError ):
36
36
_parse_external_cfg_path (external_cfg_path )
37
37
# Use `:` as operator will raise an error.
38
- external_cfg_path = 'package :path/cfg'
38
+ external_cfg_path = 'mmdet :path/cfg'
39
39
with pytest .raises (ValueError ):
40
40
_parse_external_cfg_path (external_cfg_path )
41
41
# Too much `::`
@@ -46,8 +46,5 @@ def test_parse_external_cfg_path():
46
46
47
47
def test_parse_rel_cfg_path ():
48
48
rel_cfg_path = 'cfg_dir/cfg_file'
49
- rel_cfg_dir , rel_cfg_file = _parse_rel_cfg_path (rel_cfg_path )
50
- assert rel_cfg_dir == 'cfg_dir'
51
- assert rel_cfg_file == 'cfg_file'
52
- with pytest .raises (AssertionError ):
53
- _parse_rel_cfg_path ('error/cfg_dir/cfg_file' )
49
+ cfg_name = _parse_cfg_name (rel_cfg_path )
50
+ assert cfg_name == 'cfg_file'
0 commit comments