File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1- from dbdiff .utils import get_model_names
1+ import os
2+
3+ from dbdiff .utils import get_absolute_path , get_model_names
24
35from django .contrib .auth .models import Group
46
57
68def test_get_model_names ():
79 assert get_model_names ([Group , 'auth.user' ]) == ['auth.group' , 'auth.user' ]
10+
11+
12+ def test_get_absolute_path_starting_with_dot ():
13+ assert get_absolute_path ('./foo' ) == os .path .join (
14+ os .path .abspath (os .path .dirname ('__file__' )),
15+ 'foo' ,
16+ )
Original file line number Diff line number Diff line change @@ -83,7 +83,10 @@ def get_absolute_path(path):
8383 if path .startswith ('/' ):
8484 return path
8585
86- module_path = imp .find_module (path .split ('/' )[0 ])[1 ]
86+ if path .startswith ('.' ):
87+ module_path = '.'
88+ else :
89+ module_path = imp .find_module (path .split ('/' )[0 ])[1 ]
8790 return os .path .abspath (os .path .join (
8891 module_path ,
8992 * path .split ('/' )[1 :]
You can’t perform that action at this time.
0 commit comments