File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 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):
139139
140140 project_dir = find_django_path (args )
141141 if project_dir :
142- sys .path .insert (0 , str (project_dir ))
142+ sys .path .insert (0 , str (project_dir . absolute () ))
143143 return PROJECT_FOUND % project_dir
144144 return PROJECT_NOT_FOUND
145145
Original file line number Diff line number Diff line change @@ -23,6 +23,24 @@ def test_foobar():
2323 assert outcomes ['passed' ] == 1
2424
2525
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+
2644@pytest .mark .django_project (project_root = 'django_project_root' ,
2745 create_manage_py = True )
2846def test_django_project_found_invalid_settings (django_testdir , monkeypatch ):
You can’t perform that action at this time.
0 commit comments