File tree 2 files changed +19
-1
lines changed 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ def find_django_path(args):
139
139
140
140
project_dir = find_django_path (args )
141
141
if project_dir :
142
- sys .path .insert (0 , str (project_dir ))
142
+ sys .path .insert (0 , str (project_dir . absolute () ))
143
143
return PROJECT_FOUND % project_dir
144
144
return PROJECT_NOT_FOUND
145
145
Original file line number Diff line number Diff line change @@ -23,6 +23,24 @@ def test_foobar():
23
23
assert outcomes ['passed' ] == 1
24
24
25
25
26
+ @pytest .mark .django_project (project_root = 'django_project_root' ,
27
+ create_manage_py = True )
28
+ def test_django_project_found_absolute (django_testdir , monkeypatch ):
29
+ """This only tests that "." is added as an absolute path (#637)."""
30
+ django_testdir .create_test_module ("""
31
+ def test_dot_not_in_syspath():
32
+ import sys
33
+ assert '.' not in sys.path[:5]
34
+ """ )
35
+ monkeypatch .chdir ('django_project_root' )
36
+ # NOTE: the "." here is important to test for an absolute path being used.
37
+ result = django_testdir .runpytest_subprocess ('-s' , '.' )
38
+ assert result .ret == 0
39
+
40
+ outcomes = result .parseoutcomes ()
41
+ assert outcomes ['passed' ] == 1
42
+
43
+
26
44
@pytest .mark .django_project (project_root = 'django_project_root' ,
27
45
create_manage_py = True )
28
46
def test_django_project_found_invalid_settings (django_testdir , monkeypatch ):
You can’t perform that action at this time.
0 commit comments