Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove isolated option while adding sys.path #335

Merged
merged 5 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ansible_compat/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def warning(

def _add_sys_path_to_collection_paths(self) -> None:
"""Add the sys.path to the collection paths."""
if not self.isolated and self.config.collections_scan_sys_path:
if self.config.collections_scan_sys_path:
for path in sys.path:
if (
path not in self.config.collections_paths
Expand Down
9 changes: 3 additions & 6 deletions test/test_runtime_scan_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
class ScanSysPath:
"""Parameters for scan tests."""

isolated: bool
scan: bool
raises_not_found: bool

Expand All @@ -38,10 +37,8 @@ def __str__(self) -> str:
@pytest.mark.parametrize(
("param"),
(
ScanSysPath(isolated=True, scan=True, raises_not_found=True),
ScanSysPath(isolated=True, scan=False, raises_not_found=True),
ScanSysPath(isolated=False, scan=True, raises_not_found=False),
ScanSysPath(isolated=False, scan=False, raises_not_found=True),
ScanSysPath(scan=False, raises_not_found=True),
ScanSysPath(scan=True, raises_not_found=False),
),
ids=str,
)
Expand Down Expand Up @@ -87,7 +84,7 @@ def test_scan_sys_path(
f"""
import json;
from ansible_compat.runtime import Runtime;
r = Runtime(isolated={param.isolated});
r = Runtime();
fv, cp = r.require_collection(name="{V2_COLLECTION_FULL_NAME}", version="{V2_COLLECTION_VERSION}", install=False);
print(json.dumps({{"found_version": str(fv), "collection_path": str(cp)}}));
""",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ setenv =
PIP_DISABLE_PIP_VERSION_CHECK = 1
PIP_CONSTRAINT = {toxinidir}/requirements.txt
PRE_COMMIT_COLOR = always
PYTEST_REQPASS = 93
PYTEST_REQPASS = 91
FORCE_COLOR = 1
allowlist_externals =
ansible
Expand Down