From fa0c0648415e15c682fcf43a5e0326f7803a2c31 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Fri, 2 Sep 2022 14:04:36 -0300 Subject: [PATCH] Fix skipped collection of pytest integration test files On integration tests file collection, the value of `environment.executable` can also be a symlink (e.g. in a virtualenv) with a different name than, but pointing to the same as `sys.executable` (e.g. .../bin/python3.10 and .../bin/python, respectively). That causes skipping the collection of `completion/pytest.py` and `completion/conftest.py` a lot of times, depending on the environment. (e.g. "60 skipped" before x "23 skipped" after, in a local virtualenv) --- jedi/inference/references.py | 1 + test/run.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/jedi/inference/references.py b/jedi/inference/references.py index 5a9973c4..d01890bd 100644 --- a/jedi/inference/references.py +++ b/jedi/inference/references.py @@ -237,6 +237,7 @@ def recurse_find_python_folders_and_files(folder_io, except_paths=()): for folder_io in folder_ios: yield folder_io, None + def recurse_find_python_files(folder_io, except_paths=()): for folder_io, file_io in recurse_find_python_folders_and_files(folder_io, except_paths): if file_io is not None: diff --git a/test/run.py b/test/run.py index 1f1c9dc9..01fe5354 100755 --- a/test/run.py +++ b/test/run.py @@ -209,7 +209,7 @@ class IntegrationTestCase(BaseTestCase): TEST_REFERENCES: self.run_get_references, } if (self.path.endswith('pytest.py') or self.path.endswith('conftest.py')) \ - and environment.executable != os.path.realpath(sys.executable): + and os.path.realpath(environment.executable) != os.path.realpath(sys.executable): # It's not guarantueed that pytest is installed in test # environments, if we're not running in the same environment that # we're already in, so just skip that case.