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

Add sys.path to collection paths #318

Merged
merged 6 commits into from
Aug 21, 2023

Conversation

cidrblock
Copy link
Collaborator

Related: ansible/molecule#4017

If not isolated and COLLECTION_SCAN_SYS_PATH is true, add the sys.paths to collection paths.

This is intended to mimic the functionality of the collection loader

@cidrblock cidrblock requested a review from a team as a code owner August 17, 2023 20:59
@github-actions github-actions bot added the bug Something isn't working label Aug 17, 2023
src/ansible_compat/runtime.py Show resolved Hide resolved
test/test_runtime.py Show resolved Hide resolved
@cidrblock cidrblock merged commit baca1c6 into ansible:main Aug 21, 2023
22 checks passed
Copy link
Contributor

@audgirka audgirka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

src/ansible_compat/runtime.py Show resolved Hide resolved
ScanSysPath(isolated=True, scan=True, expected=False),
ScanSysPath(isolated=True, scan=False, expected=False),
ScanSysPath(isolated=False, scan=True, expected=True),
ScanSysPath(isolated=False, scan=False, expected=False),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the result, if scan is False, no matter what value isolated is, the expected is always False.

If scan is True, I think the expected should be True. It's not related to isolated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if not self.isolated and self.config.collections_scan_sys_path:

this one confirms that if isolated and scan sys is true we still don't inject

        ScanSysPath(isolated=True, scan=False, expected=False),

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need add isolated in condition.

IIUC, this is a common issue.

No matter it is isolated, the sys.path is required.

Let me know what you think.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need @ssbarnea's input here, since lint uses isolated, I think he will better know the impact... Maybe a sperate PR to remove the isolated logic and see what he says?

I do not have a good understanding of what isolated is intended to accomplish :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants