Refactored cmake file once again - exposing root exception.

This commit is contained in:
Markus Lampert
2017-01-27 22:39:53 -08:00
parent e1a22b796e
commit 013043b18c
2 changed files with 27 additions and 19 deletions

View File

@@ -97,20 +97,28 @@ SET(PathTests_SRCS
PathTests/TestPathPost.py
PathTests/__init__.py
PathTests/test_linuxcnc_00.ngc
TestPathApp.py
)
SET(all_files
${PathScripts_SRCS}
${PathScripts_NC_SRCS}
${PathTests_SRCS}
)
ADD_CUSTOM_TARGET(PathScripts ALL
SOURCES ${all_files}
)
SET(test_files
TestPathApp.py
${PathTests_SRCS}
)
ADD_CUSTOM_TARGET(PathTests ALL
SOURCES ${test_files}
)
fc_copy_sources(PathScripts "${CMAKE_BINARY_DIR}/Mod/Path" ${all_files})
fc_copy_sources(PathTests "${CMAKE_BINARY_DIR}/Mod/Path" ${test_files})
INSTALL(
FILES

View File

@@ -34,24 +34,24 @@ import unittest
def tryLoadingTest(testName):
"Loads and returns testName, or a failing TestCase if unsuccessful."
try:
return unittest.defaultTestLoader.loadTestsFromName(testName)
# try:
return unittest.defaultTestLoader.loadTestsFromName(testName)
except ImportError:
class LoadFailed(unittest.TestCase):
def __init__(self, testName):
# setattr() first, because TestCase ctor checks for methodName.
setattr(self, "failed_to_load_" + testName, self._runTest)
super(LoadFailed, self).__init__("failed_to_load_" + testName)
self.testName = testName
def __name__(self):
return "Loading " + self.testName
def _runTest(self):
self.fail("Couldn't load " + self.testName)
return LoadFailed(testName)
# except ImportError:
# class LoadFailed(unittest.TestCase):
# def __init__(self, testName):
# # setattr() first, because TestCase ctor checks for methodName.
# setattr(self, "failed_to_load_" + testName, self._runTest)
# super(LoadFailed, self).__init__("failed_to_load_" + testName)
# self.testName = testName
#
# def __name__(self):
# return "Loading " + self.testName
#
# def _runTest(self):
# self.fail("Couldn't load " + self.testName)
#
# return LoadFailed(testName)
def All():
# Base system tests