def setUp(self): """ The setUp method is called before running any test. It is used to set the general conditions for the tests to run correctly. For GUI Tests, you always have to call setWidget to tell the framework what you will be testing. """ self.app = getAppInstance() if not self.app.guiInitialized: # First test needs to init the gui self.app.initGui() self.documentController = list(self.app.documentControllers)[0] else: # subsequent tests can just open a new document document = self.app.newDocument() self.documentController = document.controller() self.mainWindow = self.documentController.win # Include this or the automatic build will hang self.app.dontAskAndJustDiscardUnsavedChanges = True # By setting the widget to the main window we can traverse and # interact with any part of it. Also, tearDown will close # the application so we don't need to worry about that. self.setWidget(self.mainWindow, False, None)
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # # http://www.opensource.org/licenses/mit-license.php """ main.py Created by Shawn Douglas on 2010-09-26. """ import sys from cadnano import app as getAppInstance app = getAppInstance(appArgs=sys.argv) if __name__ == '__main__': if "-p" in sys.argv: import cProfile cProfile.run('app.exec_()', 'caDNAnoProfileOut.tmp') exit() elif "-P" in sys.argv: from pstats import Stats s = Stats('caDNAnoProfileOut.tmp') print "Internal Time Top 10:" s.sort_stats('cumulative').print_stats(10) print "" print "Total Time Top 10:" s.sort_stats('time').print_stats(10) exit() app.exec_()
if "-p" not in sys.argv: # Having our own NSApplication doesn't play nice with # collecting profile data. try: # If we are in Mac OS X, initialize Mac OS X specific stuff supportsPythonObjCBridge = False import objc supportsPythonObjCBridge = True except: pass if supportsPythonObjCBridge: from osx.CNApplicationDelegate import sharedDelegate as appDelegate app = getAppInstance() app.initGui() if __name__ == '__main__': if "-p" in sys.argv: print "Collecting profile data into CADnanoProfileOut.tmp" import cProfile cProfile.run('app.exec_()', 'CADnanoProfileOut.tmp') print "Done collecting profile data. Use -P to print it out." exit() elif "-P" in sys.argv: from pstats import Stats s = Stats('CADnanoProfileOut.tmp') print "Internal Time Top 10:" s.sort_stats('cumulative').print_stats(10) print "" print "Total Time Top 10:"
argv = [s for s in sys.argv] if "-t" in argv: os.environ['CADNANO_IGNORE_ENV_VARS_EXCEPT_FOR_ME'] = 'YES' from cadnano import app as getAppInstance if "-p" not in sys.argv: # Having our own NSApplication doesn't play nice with # collecting profile data. try: # If we are in Mac OS X, initialize Mac OS X specific stuff import objc from osx.CNApplicationDelegate import sharedDelegate as appDelegate except: pass app = getAppInstance(appArgs=argv) app.initGui() if __name__ == '__main__': if "-p" in sys.argv: print "Collecting profile data into CADnanoProfileOut.tmp" import cProfile cProfile.run('app.exec_()', 'CADnanoProfileOut.tmp') print "Done collecting profile data. Use -P to print it out." exit() elif "-P" in sys.argv: from pstats import Stats s = Stats('CADnanoProfileOut.tmp') print "Internal Time Top 10:" s.sort_stats('cumulative').print_stats(10) print "" print "Total Time Top 10:"