diff --git a/conftest.py b/conftest.py index 89d096d9..a45f1e3d 100644 --- a/conftest.py +++ b/conftest.py @@ -1,6 +1,7 @@ import tempfile import shutil import os +import sys import pytest @@ -87,3 +88,14 @@ def environment(): return get_default_environment() 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()) diff --git a/test/test_integration.py b/test/test_integration.py index 93446493..7df1e81e 100644 --- a/test/test_integration.py +++ b/test/test_integration.py @@ -31,9 +31,11 @@ unspecified = %s """ % (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: 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 monkeypatch.chdir(os.path.join(repo_root, 'jedi')) case.run(assert_case_equal, environment)