mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 14:34:31 +08:00
Make it possible to explicitly state the version in pytest for different envs
This commit is contained in:
12
conftest.py
12
conftest.py
@@ -1,7 +1,6 @@
|
|||||||
import tempfile
|
import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@@ -38,6 +37,9 @@ def pytest_addoption(parser):
|
|||||||
parser.addoption("--warning-is-error", action='store_true',
|
parser.addoption("--warning-is-error", action='store_true',
|
||||||
help="Warnings are treated as errors.")
|
help="Warnings are treated as errors.")
|
||||||
|
|
||||||
|
parser.addoption("--env", action='store',
|
||||||
|
help="Execute the tests in that environment (e.g. 35 for python3.5).")
|
||||||
|
|
||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
global jedi_cache_directory_orig, jedi_cache_directory_temp
|
global jedi_cache_directory_orig, jedi_cache_directory_temp
|
||||||
@@ -82,8 +84,12 @@ def clean_jedi_cache(request):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='session')
|
@pytest.fixture(scope='session')
|
||||||
def environment():
|
def environment(request):
|
||||||
version = os.environ.get('JEDI_TEST_ENVIRONMENT', str(py_version))
|
if request is None:
|
||||||
|
version = os.environ.get('JEDI_TEST_ENVIRONMENT', str(py_version))
|
||||||
|
else:
|
||||||
|
version = request.config.option.env
|
||||||
|
|
||||||
if int(version) == py_version:
|
if int(version) == py_version:
|
||||||
return get_default_environment()
|
return get_default_environment()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user