diff --git a/conftest.py b/conftest.py index 91e772b3..4c6abf25 100644 --- a/conftest.py +++ b/conftest.py @@ -147,6 +147,12 @@ def has_typing(environment): return bool(script.infer()) +@pytest.fixture(scope='session') +def has_django(environment): + script = jedi.Script('import django', environment=environment) + return bool(script.infer()) + + @pytest.fixture(scope='session') def jedi_path(): return os.path.dirname(__file__) diff --git a/test/test_integration.py b/test/test_integration.py index 378fe893..ffa9cfe3 100644 --- a/test/test_integration.py +++ b/test/test_integration.py @@ -36,7 +36,7 @@ unspecified = %s """ % (case, sorted(d - a), sorted(a - d)) -def test_completion(case, monkeypatch, environment, has_typing): +def test_completion(case, monkeypatch, environment, has_typing, has_django): skip_reason = case.get_skip_reason(environment) if skip_reason is not None: pytest.skip(skip_reason) @@ -47,6 +47,8 @@ def test_completion(case, monkeypatch, environment, has_typing): _CONTAINS_TYPING = ('pep0484_typing', 'pep0484_comments', 'pep0526_variables') if not has_typing and any(x in case.path for x in _CONTAINS_TYPING): pytest.skip('Needs the typing module installed to run this test.') + if not has_django and case.path.endswith('django.py'): + pytest.skip('Needs django to be installed to run this test.') repo_root = helpers.root_dir monkeypatch.chdir(os.path.join(repo_root, 'jedi')) case.run(assert_case_equal, environment)