From fa2712a128c84b9838a64d510b1b85026f59b658 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Mon, 11 Dec 2017 09:23:13 +0100 Subject: [PATCH] Ignore __main__ modules --- conftest.py | 6 +++++- jedi/evaluate/project.py | 10 +++++----- pytest.ini | 4 +++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/conftest.py b/conftest.py index 2567fcde..2b1dbef5 100644 --- a/conftest.py +++ b/conftest.py @@ -5,7 +5,11 @@ import pytest import jedi -collect_ignore = ["setup.py"] +collect_ignore = [ + 'setup.py', + '__main__.py', + 'jedi/evaluate/compiled/subprocess/__main__.py' +] # The following hooks (pytest_configure, pytest_unconfigure) are used diff --git a/jedi/evaluate/project.py b/jedi/evaluate/project.py index 6a3df7e9..6f6a15e7 100644 --- a/jedi/evaluate/project.py +++ b/jedi/evaluate/project.py @@ -12,12 +12,12 @@ class Project(object): if sys_path is not None: self._base_sys_path = sys_path - venv = os.getenv('VIRTUAL_ENV') - if venv: - sys_path = get_venv_path(venv) - if sys_path is None: - sys_path = sys.path + venv = os.getenv('VIRTUAL_ENV') + if venv: + sys_path = get_venv_path(venv) + else: + sys_path = sys.path base_sys_path = list(sys_path) try: diff --git a/pytest.ini b/pytest.ini index 323d03ed..fd74c60d 100644 --- a/pytest.ini +++ b/pytest.ini @@ -2,7 +2,9 @@ addopts = --doctest-modules # Ignore broken files in blackbox test directories -norecursedirs = .* docs completion refactor absolute_import namespace_package scripts extensions speed static_analysis not_in_sys_path buildout_project sample_venvs init_extension_module simple_import +norecursedirs = .* docs completion refactor absolute_import namespace_package + scripts extensions speed static_analysis not_in_sys_path buildout_project + sample_venvs init_extension_module simple_import # Activate `clean_jedi_cache` fixture for all tests. This should be # fine as long as we are using `clean_jedi_cache` as a session scoped