Commit 1adcf781 authored by Jørgen Lind's avatar Jørgen Lind
Browse files

Add pytest unit test

parent 1dae8597
......@@ -6,3 +6,4 @@ breathe
recommonmark
sphinx-markdown-tables
sphinx-rtd-theme
pytest
scikit-build
pybind11
numpy
pytest
......@@ -16,7 +16,24 @@ function(add_python_test scope test_file)
)
endfunction()
function(add_python_pytest scope test_file)
if (UNIX)
set(separator ":")
else ()
set(separator ";")
endif()
string(REGEX REPLACE "\.py$" "" test_name ${test_file})
add_test(NAME "python.${scope}.${test_name}"
COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=$<TARGET_FILE_DIR:core>/..${separator}${CMAKE_CURRENT_BINARY_DIR}"
${Python3_EXECUTABLE} -m pytest ${test_file}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endfunction()
add_python_test("python" "basictest.py")
add_python_test("python" "createtest.py")
add_python_test("python" "VolumeDataAccessor.py")
#add_python_test("python" "fixedarraytest.py")
add_python_pytest("python" "pytest_test.py")
import pytest
import unittest
class ClassTest(unittest.TestCase):
@pytest.mark.xfail
def test_feature_a(self):
self.assertEqual(2, 3)
def test_feature_b(self):
self.assertTrue(True)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment