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_PYTHON_UNIT_TEST: allow multiple paths in argn #240

Merged
merged 1 commit into from
Oct 1, 2019

Conversation

nim65s
Copy link
Collaborator

@nim65s nim65s commented Sep 30, 2019

Hi,

Multiple paths can be set in PYTHONPATH, but they have to be joined by os.pathsep,, which is : on unix, and ; on windows (ref).

This PR fix the concatenation with any pre-existing environment variables, and allows to set several folders (relative to the project build tree) inside this PYTHONPATH.

eg. if you build a module in src/ and a test module in tests/, you can import them both in a test with:
ADD_PYTHON_UNIT_TEST("test-python" "tests/main.py" "src" "tests")

Multiple paths can be set in PYTHONPATH, but they have to be joined by
`os.pathsep`(":" on unix, ";" on windows)
https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH

This commit fix the concatenation with any pre-existing environment
variables, and allows to set several folders (relative to the project
build tree) inside this PYTHONPATH.

eg. if you build a module in src/ and a test module in tests/, you can
import them both in a test with:
ADD_PYTHON_UNIT_TEST("test-python" "tests/main.py" "src" "tests")
@jcarpent jcarpent merged commit 429af97 into jrl-umi3218:master Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants