Skip to content

Commit

Permalink
Remove isolated option while adding sys.path (#335)
Browse files Browse the repository at this point in the history
* Validate isolated option

* Test changes

* Modify test count

* change fail_under count
  • Loading branch information
shatakshiiii authored Oct 6, 2023
1 parent 169a9e6 commit 7ae09fc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
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

0 comments on commit 7ae09fc

Please sign in to comment.