Browse Source

Added unit test stub

Jaime van Kessel 8 years ago
parent
commit
46ff3f4408
3 changed files with 11 additions and 0 deletions
  1. 6 0
      CMakeLists.txt
  2. 4 0
      pytest.ini
  3. 1 0
      tests/TestMachineAction.py

+ 6 - 0
CMakeLists.txt

@@ -6,6 +6,12 @@ include(GNUInstallDirs)
 
 
 set(URANIUM_SCRIPTS_DIR "${CMAKE_SOURCE_DIR}/../uranium/scripts" CACHE DIRECTORY "The location of the scripts directory of the Uranium repository")
 set(URANIUM_SCRIPTS_DIR "${CMAKE_SOURCE_DIR}/../uranium/scripts" CACHE DIRECTORY "The location of the scripts directory of the Uranium repository")
 
 
+# Tests
+# Note that we use exit 0 here to not mark the build as a failure on test failure
+add_custom_target(tests)
+add_custom_command(TARGET tests POST_BUILD COMMAND "PYTHONPATH=${CMAKE_SOURCE_DIR}" ${PYTHON_EXECUTABLE} -m pytest -r a --junitxml=${CMAKE_BINARY_DIR}/junit.xml ${CMAKE_SOURCE_DIR} || exit 0)
+
+
 set(CURA_VERSION "master" CACHE STRING "Version name of Cura")
 set(CURA_VERSION "master" CACHE STRING "Version name of Cura")
 configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY)
 configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY)
 
 

+ 4 - 0
pytest.ini

@@ -0,0 +1,4 @@
+[pytest]
+testpaths = tests
+python_files = Test*.py
+python_classes = Test

+ 1 - 0
tests/TestMachineAction.py

@@ -0,0 +1 @@
+#Todo: Write tests