eric5-unittest.py

changeset 896
f855351d5e98
parent 894
eab7b8d39807
child 897
3dcaa3195a64
equal deleted inserted replaced
894:eab7b8d39807 896:f855351d5e98
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3
4 # Copyright (c) 2002 - 2011 Detlev Offenbach <detlev@die-offenbachs.de>
5 #
6
7 """
8 Eric5 Unittest
9
10 This is the main Python script that performs the necessary initialization
11 of the unittest module and starts the Qt event loop. This is a standalone
12 version of the integrated unittest module.
13 """
14
15 import sys
16
17 for arg in sys.argv:
18 if arg.startswith("--config="):
19 import Utilities
20 configDir = arg.replace("--config=", "")
21 Utilities.setConfigDir(configDir)
22 sys.argv.remove(arg)
23 break
24
25 from Utilities import Startup
26
27
28 def createMainWidget(argv):
29 """
30 Function to create the main widget.
31
32 @param argv list of commandline parameters (list of strings)
33 @return reference to the main widget (QWidget)
34 """
35 from PyUnit.UnittestDialog import UnittestWindow
36 try:
37 fn = argv[1]
38 except IndexError:
39 fn = None
40 return UnittestWindow(fn)
41
42 def main():
43 """
44 Main entry point into the application.
45 """
46 options = [\
47 ("--config=configDir",
48 "use the given directory as the one containing the config files"),
49 ]
50 appinfo = Startup.makeAppInfo(sys.argv,
51 "Eric5 Unittest",
52 "file",
53 "Graphical unit test application",
54 options)
55 res = Startup.simpleAppStartup(sys.argv,
56 appinfo,
57 createMainWidget)
58 sys.exit(res)
59
60 if __name__ == '__main__':
61 main()

eric ide

mercurial