Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
5e4e737
Skip frameRestore test
mesalu Feb 6, 2017
2c1c147
Bumpy groundwork for improving unittests with full App usability
mesalu Feb 7, 2017
5dbed79
now generating app/frame/testcase classes
mesalu Feb 9, 2017
66416d9
Removed now redundant TestFrame class from ATC
mesalu Feb 9, 2017
73106e2
minor errors
mesalu Feb 9, 2017
4e1dc22
mesalu Feb 10, 2017
7aefc60
Update a couple test files to ensure particular features are working
mesalu Feb 10, 2017
3cfc913
Now generating test wrappers
mesalu Feb 12, 2017
6abef14
Adapted test_frame to new test case style
mesalu Feb 12, 2017
590c399
Demorgan's law and ensuring a non-zero exit on failure.
mesalu Feb 12, 2017
40cd8cb
Add decorator method for catching exceptions and aborting
mesalu Feb 12, 2017
6129500
Changed decorator method name to better reflect its role
mesalu Feb 13, 2017
7bea6c8
Ensure method decorations are preserved through to the wrappedm ethod
mesalu Feb 14, 2017
294f110
communicate critical exceptions to outside of app
mesalu Feb 14, 2017
b6c2f40
Merge branch 'WIP_atc' of github.com:mesalu/Phoenix into WIP_atc
mesalu Feb 14, 2017
570f82d
fixed TestError exception
mesalu Feb 14, 2017
7b682e3
Merge branch 'master' into WIP_atc
mesalu Feb 14, 2017
022da56
updated documentation at top of module
mesalu Feb 14, 2017
f1b8aea
Added TestCritical decorator to ensure, to cover TestError change to …
mesalu Feb 14, 2017
9fbb399
added 5 minute watchdog to TestWidget. A runtime error is raised shou…
mesalu Feb 15, 2017
01af107
Swapped from directly using a timer to CallLater, removed unnecessari…
mesalu Feb 15, 2017
cba6425
swapped from TestDone to testFailed and testPassed
mesalu Feb 16, 2017
f76042e
Changed TestCritical to testCritical, added informative docstring, mo…
mesalu Feb 16, 2017
4f57a1c
Changed test launch as per @RobinD42's suggestions.
mesalu Feb 16, 2017
0a0a356
Update test_frame to work with recent atc changes
mesalu Feb 16, 2017
a3bf5aa
Changed CreateATC to createATC
mesalu Feb 16, 2017
c4ce207
Added a ton of documentation.
mesalu Feb 16, 2017
4443607
Added additional test case to test_atc, renamed test class name in te…
mesalu Feb 16, 2017
124d214
Create ATC for ATCFrame (oops)
mesalu Feb 16, 2017
e80487d
fixed conditional
mesalu Feb 17, 2017
c7d2e52
corrected for timing issue that arose in linux
mesalu Feb 17, 2017
c4aa4de
Provide access to TestCase class instance through new TestWidget meth…
mesalu Feb 17, 2017
2c8f11d
Conformed Argument name to denote argument is a class
mesalu Feb 20, 2017
8c4b396
temporarily removed support for testing dialog derivatives
mesalu Feb 20, 2017
1806a89
Support wx.Dialog derivatives by launching them modeless. Normal test…
mesalu Feb 20, 2017
1270bb2
Do not impose showing the Frame in instances where the Frame is the c…
mesalu Feb 22, 2017
51472c5
Do not impose showing the Frame in instances where the Frame is the c…
mesalu Feb 22, 2017
ca5a56c
Merged branch WIP_atc into WIP_atc
mesalu Feb 23, 2017
f7ae86f
Added autoshow argument to allow test creators to disable automatical…
mesalu Feb 24, 2017
d532d0a
updated generated frame naming to reflect the test widget's class nam…
mesalu Feb 24, 2017
c56cd5d
Print traceback/stacktrace where applicable in the event of test fail…
mesalu Mar 9, 2017
23aff36
Moved procedure to print stack trace to a new TestWidget method, adju…
mesalu Mar 12, 2017
901ee05
Add docstring describing ATC components
mesalu May 23, 2017
f0b7082
remove deprecated comment block.
mesalu May 23, 2017
5c9c989
extraenous cleanup
mesalu May 23, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add decorator method for catching exceptions and aborting
  • Loading branch information
mesalu committed Feb 12, 2017
commit 40cd8cbf83c3e02d1fc5b6ba1c0061c9eedda2cc
15 changes: 13 additions & 2 deletions unittests/atc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

__version__ = "0.0.1"

import functools
import os
import sys
import unittest
Expand Down Expand Up @@ -101,6 +102,16 @@ def TestDone(self, passed = True):
# wx.GetApp().GetMainLoop().Exit(30)
sys.exit(1)

def TestDependent(func):
@functools.wraps(func)
def method(*args, **kwargs):
try:
func(*args, **kwargs)
except Exception as e:
print("Unbound exception caught in test procedure:\n%s\n%s" % (e.__class__, str(e)), file = sys.stderr)
# give full stack trace
args[0].TestDone(False)
return method

def CreateApp(frame):
class TestApp(wx.App):
Expand Down Expand Up @@ -164,5 +175,5 @@ class ApplicationTestCase(unittest.TestCase):

return ApplicationTestCase

if __name__ == "__main__":
pass


10 changes: 7 additions & 3 deletions unittests/test_atc.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
from unittests import atc
import wx
import unittest
import random

random.seed()

class PanelColorChangeTester(wx.Panel, atc.TestWidget):
def __init__(self, parent):
Expand All @@ -20,8 +17,15 @@ def test_fail(self):
print("Failing test")
self.TestDone(False)

@atc.TestDependent
def test_abort(self):
print("Aborting test case")
raise AttributeError("Unbound attribute error")


testcase = atc.CreateATC(PanelColorChangeTester)

if __name__ == "__main__":
testcase.test_abort(testcase)
unittest.main()