Try to fix a test for Windows

This commit is contained in:
Dave Halter
2022-11-13 23:48:43 +01:00
parent 89f9a3a7f1
commit 66c52b4bc7

View File

@@ -1,6 +1,7 @@
import os import os
from textwrap import dedent from textwrap import dedent
from pathlib import Path from pathlib import Path
import platform
import pytest import pytest
@@ -73,15 +74,19 @@ def test_diff_without_ending_newline(Script):
def test_diff_path_outside_of_project(Script): def test_diff_path_outside_of_project(Script):
if platform.system().lower() == 'windows':
abs_path = r'D:\unknown_dir\file.py'
else:
abs_path = '/unknown_dir/file.py'
script = Script( script = Script(
code='foo = 1', code='foo = 1',
path='/unknown_dir/file.py', path=abs_path,
project=jedi.get_default_project() project=jedi.get_default_project()
) )
diff = script.rename(line=1, column=0, new_name='bar').get_diff() diff = script.rename(line=1, column=0, new_name='bar').get_diff()
assert diff == dedent('''\ assert diff == dedent(f'''\
--- /unknown_dir/file.py --- {abs_path}
+++ /unknown_dir/file.py +++ {abs_path}
@@ -1 +1 @@ @@ -1 +1 @@
-foo = 1 -foo = 1
+bar = 1 +bar = 1