Skip to content

Commit

Permalink
Restored exception masking - although i'm not sure it's a good thing.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlampert committed Jan 28, 2017
1 parent c9c7d19 commit d4da536
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/Mod/Test/TestApp.py
Expand Up @@ -34,24 +34,24 @@
def tryLoadingTest(testName):
"Loads and returns testName, or a failing TestCase if unsuccessful."

# 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)
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)

def All():
# Base system tests
Expand Down

0 comments on commit d4da536

Please sign in to comment.