Browse Source

tests: Use sys.executable during tests

Sebastian Pipping 1 year ago
parent
commit
0819d23f47
3 changed files with 6 additions and 1 deletions
  1. 1
    0
      setup.py
  2. 4
    1
      tests/test_servefile.py
  3. 1
    0
      tox.ini

+ 1
- 0
setup.py View File

@@ -14,6 +14,7 @@ setup(
14 14
 	author_email='seba@someserver.de',
15 15
 	install_requires=['pyopenssl'],
16 16
 	tests_require=[
17
+		'pathlib2; python_version<"3"',
17 18
 		'pytest',
18 19
 		'requests',
19 20
 	],

+ 4
- 1
tests/test_servefile.py View File

@@ -13,8 +13,10 @@ import urllib3
13 13
 
14 14
 
15 15
 if sys.version_info.major >= 3:
16
+    from pathlib import Path
16 17
     connrefused_exc = ConnectionRefusedError
17 18
 else:
19
+    from pathlib2 import Path
18 20
     connrefused_exc = socket.error
19 21
 
20 22
 
@@ -26,7 +28,8 @@ def run_servefile():
26 28
         if not isinstance(args, list):
27 29
             args = [args]
28 30
         print("running with args", args)
29
-        p = subprocess.Popen(['servefile'] + args, **kwargs)
31
+        servefile_path = str(Path(__file__).parent.parent / 'servefile')
32
+        p = subprocess.Popen([sys.executable, servefile_path] + args, **kwargs)
30 33
         time.sleep(kwargs.get('timeout', 0.3))
31 34
         instances.append(p)
32 35
 

+ 1
- 0
tox.ini View File

@@ -3,6 +3,7 @@ envlist = py27,py36
3 3
 
4 4
 [testenv]
5 5
 deps =
6
+        pathlib2; python_version<"3"
6 7
         pytest
7 8
         requests
8 9
 commands = pytest --tb=short {posargs}

Loading…
Cancel
Save