Skip to content

Commit

Permalink
cmake: do not always add py3 to TOX_ENVS
Browse files Browse the repository at this point in the history
before this change add_tox_test() always add "py3" to testenv, even the
caller specifies TOX_ENVS explicitly.

after this change, py3 is added only if the caller does not specify any
TOX_ENVS.

this change helps with the readability.

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Oct 14, 2020
1 parent 493f216 commit 7c1544c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cmake/modules/AddCephTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ function(add_tox_test name)
else()
set(tox_path ${CMAKE_CURRENT_SOURCE_DIR})
endif()
list(APPEND tox_envs py3)
if(DEFINED TOXTEST_TOX_ENVS)
list(APPEND tox_envs ${TOXTEST_TOX_ENVS})
else()
list(APPEND tox_envs py3)
endif()
string(REPLACE ";" "," tox_envs "${tox_envs}")
find_package(Python3 QUIET REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion qa/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ endif()

if(WITH_TESTS)
include(AddCephTest)
add_tox_test(qa TOX_ENVS flake8 import-tasks)
add_tox_test(qa TOX_ENVS py3 flake8 import-tasks)
endif()
2 changes: 1 addition & 1 deletion src/cephadm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if(WITH_TESTS)
include(AddCephTest)
add_tox_test(cephadm TOX_ENVS mypy)
add_tox_test(cephadm TOX_ENVS py3 mypy)
endif()
2 changes: 1 addition & 1 deletion src/pybind/mgr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if(WITH_MGR_ROOK_CLIENT)
endif()
if(WITH_TESTS)
include(AddCephTest)
add_tox_test(mgr ${CMAKE_CURRENT_SOURCE_DIR} TOX_ENVS mypy)
add_tox_test(mgr ${CMAKE_CURRENT_SOURCE_DIR} TOX_ENVS py3 mypy)
endif()

# Location needs to match default setting for mgr_module_path, currently:
Expand Down
2 changes: 1 addition & 1 deletion src/pybind/mgr/dashboard/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,5 @@ add_dependencies(tests mgr-dashboard-frontend-build)

if(WITH_TESTS)
include(AddCephTest)
add_tox_test(mgr-dashboard TOX_ENVS lint check openapi-check)
add_tox_test(mgr-dashboard TOX_ENVS py3 lint check openapi-check)
endif()
2 changes: 1 addition & 1 deletion src/python-common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ distutils_install_module(ceph)

if(WITH_TESTS)
include(AddCephTest)
add_tox_test(python-common TOX_ENVS lint)
add_tox_test(python-common TOX_ENVS py3 lint)
endif()

0 comments on commit 7c1544c

Please sign in to comment.