Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
25d7b002
Commit
25d7b002
authored
12 years ago
by
Gigg, Martyn Anthony
Browse files
Options
Downloads
Patches
Plain Diff
Include helper code for Python unit tests... Refs #6219.
in an analogous way that it is done with cxxtest_add_test.
parent
1ff8b35c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Mantid/Build/CMake/FindPyUnitTest.cmake
+14
-1
14 additions, 1 deletion
Code/Mantid/Build/CMake/FindPyUnitTest.cmake
Code/Mantid/Framework/PythonInterface/CMakeLists.txt
+5
-15
5 additions, 15 deletions
Code/Mantid/Framework/PythonInterface/CMakeLists.txt
with
19 additions
and
16 deletions
Code/Mantid/Build/CMake/FindPyUnitTest.cmake
+
14
−
1
View file @
25d7b002
...
...
@@ -25,9 +25,22 @@ macro ( PYUNITTEST_ADD_TEST _pyunit_testname_file )
set
(
_pyunit_testfiles
${
_pyunit_testfiles
}
${
_pyunit_outputdir
}
/
${
_pyunit_file
}
)
endforeach
(
part
${
ARGN
}
)
# The TESTHELPER_PY_FILES variable can be used outside of this macro
# to include any helper classes that are not run through the python unittest generator
set
(
_testhelper_files
""
)
foreach
(
part
${
TESTHELPER_PY_FILES
}
)
get_filename_component
(
_testhelper_file
${
part
}
NAME
)
add_custom_command
(
OUTPUT
${
_pyunit_outputdir
}
/
${
_testhelper_file
}
DEPENDS
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
part
}
COMMAND
${
CMAKE_COMMAND
}
ARGS -E copy_if_different
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
part
}
${
_pyunit_outputdir
}
/
${
_testhelper_file
}
)
set
(
_testhelper_files
${
_testhelper_files
}
${
_pyunit_outputdir
}
/
${
_testhelper_file
}
)
endforeach
(
part
${
ARGN
}
)
# Main test target
add_custom_target
(
${
_pyunit_testname_file
}
DEPENDS
${
_pyunit_testfiles
}
DEPENDS
${
_pyunit_testfiles
}
${
_testhelper_files
}
COMMAND
${
PYTHON_EXECUTABLE
}
${
PYUNITTEST_GEN_EXEC
}
-o
${
CMAKE_LIBRARY_OUTPUT_DIRECTORY
}
/
${
CMAKE_CFG_INTDIR
}
/
${
_pyunit_testname_file
}
-d
${
_pyunit_outputdir
}
...
...
This diff is collapsed.
Click to expand it.
Code/Mantid/Framework/PythonInterface/CMakeLists.txt
+
5
−
15
View file @
25d7b002
...
...
@@ -55,6 +55,7 @@ add_subdirectory ( mantid )
###########################################################################
# Python algorithms
###########################################################################
clean_orphaned_pyc_files
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/PythonAlgorithms
)
add_compile_py_target
(
PythonAlgorithms
${
CMAKE_CURRENT_SOURCE_DIR
}
/PythonAlgorithms
)
add_dependencies
(
PythonAPIModule PythonAlgorithms
)
...
...
@@ -146,27 +147,16 @@ set ( TEST_PY_FILES
test/python/WorkspaceValidatorsTest.py
)
set
(
PYTEST_HELPERS test/python/testhelpers.py
)
# python unit tests
if
(
PYUNITTEST_FOUND
)
# pyunittest_add_test macro understands the TESTHELPER_PY_FILES variable. It is scoped to this file
# so does not need to be cleared
set
(
TESTHELPER_PY_FILES test/python/testhelpers.py
)
pyunittest_add_test
(
VanillaPythonInterfaceTest.py
${
TEST_PY_FILES
}
)
# Helpers
set
(
VANILLA_TEST_DIR
${
CMAKE_LIBRARY_OUTPUT_DIRECTORY
}
/
${
CMAKE_CFG_INTDIR
}
/VanillaPythonInterfaceTest
)
set
(
PYTEST_HELPER_INSTALLS
""
)
foreach
(
PYTEST_HELPER
${
PYTEST_HELPERS
}
)
get_filename_component
(
helper_file
${
PYTEST_HELPER
}
NAME
)
add_custom_command
(
OUTPUT
${
VANILLA_TEST_DIR
}
/
${
helper_file
}
DEPENDS
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
PYTEST_HELPER
}
COMMAND
${
CMAKE_COMMAND
}
ARGS -E copy_if_different
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
PYTEST_HELPER
}
${
VANILLA_TEST_DIR
}
/
${
helper_file
}
)
set
(
PYTEST_HELPER_INSTALLS
${
PYTEST_HELPER_INSTALLS
}
${
VANILLA_TEST_DIR
}
/
${
helper_file
}
)
endforeach
(
PYTEST_HELPER
${
PYTEST_HELPERS
}
)
add_custom_target
(
PythonTestHelpers DEPENDS
${
PYTEST_HELPER_INSTALLS
}
)
# Test Dependencies
add_dependencies
(
VanillaPythonInterfaceTest.py PythonInterface Algorithms
PythonTestHelpers
)
add_dependencies
(
VanillaPythonInterfaceTest.py PythonInterface Algorithms
)
add_dependencies
(
FrameworkTests VanillaPythonInterfaceTest.py
)
# Add to the 'UnitTests' group in VS
set_property
(
TARGET VanillaPythonInterfaceTest.py PROPERTY FOLDER
"UnitTests"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment