summaryrefslogtreecommitdiff
blob: cdc59053df033f8a15451cbb3d952505ba8e85a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
diff --git a/test/test_api/test_completion.py b/test/test_api/test_completion.py
index 178daee9..0c86f837 100644
--- a/test/test_api/test_completion.py
+++ b/test/test_api/test_completion.py
@@ -1,4 +1,5 @@
-from os.path import join, sep as s
+from os.path import join, sep as s, dirname
+import os
 import sys
 from textwrap import dedent
 
@@ -164,6 +165,7 @@ f2 = join(root_dir, 'test', 'example.py')
 os_path = 'from os.path import *\n'
 # os.path.sep escaped
 se = s * 2 if s == '\\' else s
+current_dirname = os.path.basename(dirname(dirname(dirname(__file__))))
 
 
 @pytest.mark.parametrize(
@@ -181,7 +183,7 @@ se = s * 2 if s == '\\' else s
         ('test%sexample.py' % se, 'r"test%scomp"' % s, 5, ['t' + s]),
         ('test%sexample.py' % se, 'r"test%scomp"' % s, 11, ['letion' + s]),
         ('test%sexample.py' % se, '"%s"' % join('test', 'completion', 'basi'), 21, ['c.py']),
-        ('example.py', 'rb"' + join('..', 'jedi', 'tes'), None, ['t' + s]),
+        ('example.py', 'rb"'+ join('..', current_dirname, 'tes'), None, ['t' + s]),
 
         # Absolute paths
         (None, '"' + join(root_dir, 'test', 'test_ca'), None, ['che.py"']),
diff --git a/test/test_evaluate/test_signature.py b/test/test_evaluate/test_signature.py
index 0bb5cbae..2fda3d55 100644
--- a/test/test_evaluate/test_signature.py
+++ b/test/test_evaluate/test_signature.py
@@ -16,7 +16,7 @@ from jedi.evaluate.gradual.conversion import _stub_to_python_context_set
         ('str', "str(object='', /) -> str", ['object'], ge, (2, 7)),
 
         ('pow', 'pow(x, y, z=None, /) -> number', ['x', 'y', 'z'], lt, (3, 5)),
-        ('pow', 'pow(x, y, z=None, /)', ['x', 'y', 'z'], ge, (3, 5)),
+        ('pow', 'pow(base, exp, mod=None)', ['base', 'exp', 'mod'], ge, (3, 8)),
 
         ('bytes.partition', 'partition(self, sep, /) -> (head, sep, tail)', ['self', 'sep'], lt, (3, 5)),
         ('bytes.partition', 'partition(self, sep, /)', ['self', 'sep'], ge, (3, 5)),
diff --git a/test/test_evaluate/test_sys_path.py b/test/test_evaluate/test_sys_path.py
index deaa64ca..fdee2ece 100644
--- a/test/test_evaluate/test_sys_path.py
+++ b/test/test_evaluate/test_sys_path.py
@@ -1,7 +1,9 @@
 import os
+import os.path
 from glob import glob
 import sys
 import shutil
+import distutils.sysconfig
 
 import pytest
 from ..helpers import skip_if_windows, skip_if_not_windows
@@ -33,12 +35,10 @@ def test_venv_and_pths(venv_path):
     pjoin = os.path.join
 
     CUR_DIR = os.path.dirname(__file__)
-    site_pkg_path = pjoin(venv_path, 'lib')
-    if os.name == 'nt':
-        site_pkg_path = pjoin(site_pkg_path, 'site-packages')
-    else:
-        site_pkg_path = glob(pjoin(site_pkg_path, 'python*', 'site-packages'))[0]
-    shutil.rmtree(site_pkg_path)
+    site_pkg_path = pjoin(venv_path,
+                          distutils.sysconfig.get_python_lib().lstrip(distutils.sysconfig.BASE_PREFIX))
+    if os.path.exists(site_pkg_path):
+        shutil.rmtree(site_pkg_path)
     shutil.copytree(pjoin(CUR_DIR, 'sample_venvs', 'pth_directory'), site_pkg_path)
 
     virtualenv = create_environment(venv_path)
diff --git a/test/test_utils.py b/test/test_utils.py
index 17328a36..71217086 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -77,10 +77,14 @@ class TestSetupReadline(unittest.TestCase):
         # There are minor differences, e.g. the dir doesn't include deleted
         # items as well as items that are not only available on linux.
         difference = set(self.completions(s)).symmetric_difference(goal)
-        difference = {x for x in difference if not x.startswith('from os import _')}
+        difference = {
+            x for x in difference
+            if all(not x.startswith('from os import ' + s)
+                   for s in ['_', 'O_', 'EX_', 'MFD_', 'SF_'])
+        }
         # There are quite a few differences, because both Windows and Linux
-        # (posix and nt) libraries are included.
-        assert len(difference) < 38
+        # (posix and nt) librariesare included.
+        assert len(difference) < 22
 
     @cwd_at('test')
     def test_local_import(self):