diff options
author | Andy Clayton <q3aiml@gmail.com> | 2020-03-24 22:13:38 -0500 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2020-03-25 11:47:36 +0800 |
commit | 8d61945ce7641b756de2ad253905f9fbb8828088 (patch) | |
tree | 20b3c4b89cdedb22f07ed4345941abb86758fa0f /test | |
parent | 7c45da227d6612807a2730819504cf0300021cd5 (diff) | |
download | fork-ledger-8d61945ce7641b756de2ad253905f9fbb8828088.tar.gz fork-ledger-8d61945ce7641b756de2ad253905f9fbb8828088.tar.bz2 fork-ledger-8d61945ce7641b756de2ad253905f9fbb8828088.zip |
fix setting TZ in tests
This was regressed in 139beba which set `PYTHONUNBUFFERED` to fix other
test issues. When setting multiple environment variables in this way
they need to be delimited with semicolons rather than spaces. As it is
`PYTHONUNBUFFERED` is being set to `1 TZ=America/Chicago`. The CMake docs
are not as clear about this as they probably should be.
This can be verified by throwing together a CTestTestfile.cmake:
add_test(incorrect_env "printenv" "PYTHONUNBUFFERED" "TZ")
set_tests_properties(incorrect_env PROPERTIES ENVIRONMENT "PYTHONUNBUFFERED=1 TZ=America/Chicago")
add_test(correct_env "printenv" "PYTHONUNBUFFERED" "TZ")
set_tests_properties(correct_env PROPERTIES ENVIRONMENT "PYTHONUNBUFFERED=1;TZ=America/Chicago")
When run with `ctest -V`:
1: Test command: /usr/bin/printenv "PYTHONUNBUFFERED" "TZ"
1: Environment variables:
1: PYTHONUNBUFFERED=1 TZ=America/Chicago
1: Test timeout computed to be: 10000000
1: 1 TZ=America/Chicago
1/2 Test #1: incorrect_env ....................***Failed 0.00 sec
test 2
Start 2: correct_env
2: Test command: /usr/bin/printenv "PYTHONUNBUFFERED" "TZ"
2: Environment variables:
2: PYTHONUNBUFFERED=1
2: TZ=America/Chicago
2: Test timeout computed to be: 10000000
2: 1
2: America/Chicago
2/2 Test #2: correct_env ...................... Passed 0.00 sec
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 6 | ||||
-rw-r--r-- | test/unit/CMakeLists.txt | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3e56d682..a0905004 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -34,7 +34,7 @@ macro(add_ledger_harness_tests _class) $<TARGET_FILE:ledger> ${PROJECT_SOURCE_DIR} ${TestFile} ${TEST_PYTHON_FLAGS}) set_tests_properties(${_class}Test_${TestFile_Name} - PROPERTIES ENVIRONMENT "PYTHONUNBUFFERED=1 TZ=${Ledger_TEST_TIMEZONE}") + PROPERTIES ENVIRONMENT "PYTHONUNBUFFERED=1;TZ=${Ledger_TEST_TIMEZONE}") endif() endforeach() endif() @@ -53,7 +53,7 @@ if (Python_EXECUTABLE) COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/${_class}.py --ledger $<TARGET_FILE:ledger> --file ${TestFile}) set_tests_properties(${_class}Test_${TestFile_Name} - PROPERTIES ENVIRONMENT "PYTHONUNBUFFERED=1 TZ=${Ledger_TEST_TIMEZONE}") + PROPERTIES ENVIRONMENT "PYTHONUNBUFFERED=1;TZ=${Ledger_TEST_TIMEZONE}") endforeach() # CheckManpage and CheckTexinfo are disabled, since they do not work @@ -64,7 +64,7 @@ if (Python_EXECUTABLE) COMMAND ${Python_EXECUTABLE} ${PROJECT_SOURCE_DIR}/test/${_class}.py --ledger $<TARGET_FILE:ledger> --source ${PROJECT_SOURCE_DIR}) set_tests_properties(${_class} - PROPERTIES ENVIRONMENT "PYTHONUNBUFFERED=1 TZ=${Ledger_TEST_TIMEZONE}") + PROPERTIES ENVIRONMENT "PYTHONUNBUFFERED=1;TZ=${Ledger_TEST_TIMEZONE}") endforeach() endif() diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index b3cc420c..4a9911c5 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -2,7 +2,7 @@ macro(add_ledger_test _name) target_link_libraries(${_name} libledger) add_test(Ledger${_name} ${PROJECT_BINARY_DIR}/${_name}) set_tests_properties(Ledger${_name} - PROPERTIES ENVIRONMENT "PYTHONUNBUFFERED=1 TZ=${Ledger_TEST_TIMEZONE}") + PROPERTIES ENVIRONMENT "PYTHONUNBUFFERED=1;TZ=${Ledger_TEST_TIMEZONE}") endmacro(add_ledger_test _name) include_directories(${PROJECT_SOURCE_DIR}/src) |