Skip to content

Add argument to specify environment for bash tests#2845

Closed
daljit46 wants to merge 1 commit intodevfrom
add_env_bash_tests
Closed

Add argument to specify environment for bash tests#2845
daljit46 wants to merge 1 commit intodevfrom
add_env_bash_tests

Conversation

@daljit46
Copy link
Member

@daljit46 daljit46 commented Mar 5, 2024

This adds a new function argument to add_bash_tests() to specify environment variables that should be defined for running a test.
Usage example:

add_bash_tests(
    FILE_PATH file
    PREFIX script
    WORKING_DIRECTORY ${DATA_DIR}
    ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/lib"
)

In #2678, the possibility of specifying PYTHONPATH for a given test seems to be useful. This PR addresses this need more generally, by allowing the specification of any environment variables when running a collection of tests specified in a text file.

@Lestropie this should be enough to address the issue raised, but let me know if this actually solves the problem.

@daljit46 daljit46 added the build label Mar 5, 2024
@daljit46 daljit46 requested a review from Lestropie March 5, 2024 15:35
@daljit46 daljit46 self-assigned this Mar 5, 2024
@github-actions
Copy link

github-actions bot commented Mar 5, 2024

clang-tidy review says "All clean, LGTM! 👍"

@daljit46 daljit46 force-pushed the add_env_bash_tests branch from c460314 to cc13f77 Compare March 5, 2024 16:47
This adds a new function argument to add_bash_tests() to specify
environment variables that should be defined for running a test.
@daljit46 daljit46 force-pushed the add_env_bash_tests branch from cc13f77 to eae18dc Compare March 5, 2024 16:54
@github-actions
Copy link

github-actions bot commented Mar 5, 2024

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
@github-actions
Copy link

github-actions bot commented Mar 5, 2024

clang-tidy review says "All clean, LGTM! 👍"

@Lestropie Lestropie mentioned this pull request Mar 5, 2024
Lestropie added a commit that referenced this pull request May 19, 2024
- Restore solution in #2845 not properly propagated through prior merge conflict.
- Use FileExistsError when checking for pre-existing output files / directories, and catch it to yield a well-formatted error message.
- Update CLI test data to reflect changes in 05b68d5.
- Modify tests that check for command error due to inappropriate CLI usage.
@Lestropie
Copy link
Member

Included in merge of #2678.

@Lestropie Lestropie closed this May 23, 2024
@Lestropie Lestropie deleted the add_env_bash_tests branch May 23, 2024 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants