1
0
forked from VimPlug/jedi

Add a way to skip typing tests in non default environments

This commit is contained in:
Dave Halter
2017-12-20 10:07:16 +01:00
parent 890dd2213d
commit a96f2c43df
2 changed files with 15 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
import tempfile import tempfile
import shutil import shutil
import os import os
import sys
import pytest import pytest
@@ -87,3 +88,14 @@ def environment():
return get_default_environment() return get_default_environment()
return get_python_environment('python%s.%s' % tuple(version)) return get_python_environment('python%s.%s' % tuple(version))
@pytest.fixture(scope='session')
def has_typing(environment):
if environment.version_info >= (3, 5, 0):
# This if is just needed to avoid that tests ever skip way more than
# they should for all Python versions.
return True
script = jedi.Script('import typing', environment=environment)
return bool(script.goto_definitions())

View File

@@ -31,9 +31,11 @@ unspecified = %s
""" % (case, sorted(d - a), sorted(a - d)) """ % (case, sorted(d - a), sorted(a - d))
def test_completion(case, monkeypatch, environment): def test_completion(case, monkeypatch, environment, has_typing):
if case.skip is not None: if case.skip is not None:
pytest.skip(case.skip) pytest.skip(case.skip)
if not has_typing and 'typing' in case.path:
pytest.skip('Needs the typing module installed to run this test.')
repo_root = helpers.root_dir repo_root = helpers.root_dir
monkeypatch.chdir(os.path.join(repo_root, 'jedi')) monkeypatch.chdir(os.path.join(repo_root, 'jedi'))
case.run(assert_case_equal, environment) case.run(assert_case_equal, environment)