Implement all remaining Path issues and use it instead of strings

This commit is contained in:
Dave Halter
2020-07-12 01:14:00 +02:00
parent db0e90763b
commit 480a464179
23 changed files with 131 additions and 97 deletions

View File

@@ -1,4 +1,5 @@
import os
from pathlib import Path
import pytest
@@ -21,13 +22,12 @@ def test_django_default_project(Script):
def test_django_default_project_of_file(Script):
project = get_default_project(__file__)
d = os.path.dirname
assert project._path == d(d(d(__file__)))
assert project._path == Path(__file__).parent.parent.parent
def test_interpreter_project_path():
# Run from anywhere it should be the cwd.
dir = os.path.join(root_dir, 'test')
dir = Path(root_dir).joinpath('test')
with set_cwd(dir):
project = Interpreter('', [locals()])._inference_state.project
assert project._path == dir