|
1 #!/usr/bin/env python3 |
|
2 # -*- coding: utf-8 -*- |
|
3 |
|
4 # Copyright (c) 2002 - 2010 Detlev Offenbach <detlev@die-offenbachs.de> |
|
5 # |
|
6 |
|
7 """ |
|
8 Eric4 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 import os |
|
17 |
|
18 for arg in sys.argv: |
|
19 if arg.startswith("--config="): |
|
20 import Utilities |
|
21 configDir = arg.replace("--config=", "") |
|
22 Utilities.setConfigDir(configDir) |
|
23 sys.argv.remove(arg) |
|
24 break |
|
25 |
|
26 from Utilities import Startup |
|
27 |
|
28 |
|
29 def createMainWidget(argv): |
|
30 """ |
|
31 Function to create the main widget. |
|
32 |
|
33 @param argv list of commandline parameters (list of strings) |
|
34 @return reference to the main widget (QWidget) |
|
35 """ |
|
36 from PyUnit.UnittestDialog import UnittestWindow |
|
37 try: |
|
38 fn = argv[1] |
|
39 except IndexError: |
|
40 fn = None |
|
41 return UnittestWindow(fn) |
|
42 |
|
43 def main(): |
|
44 """ |
|
45 Main entry point into the application. |
|
46 """ |
|
47 options = [\ |
|
48 ("--config=configDir", |
|
49 "use the given directory as the one containing the config files"), |
|
50 ] |
|
51 appinfo = Startup.makeAppInfo(sys.argv, |
|
52 "Eric4 Unittest", |
|
53 "file", |
|
54 "Graphical unit test application", |
|
55 options) |
|
56 res = Startup.simpleAppStartup(sys.argv, |
|
57 appinfo, |
|
58 createMainWidget) |
|
59 sys.exit(res) |
|
60 |
|
61 if __name__ == '__main__': |
|
62 main() |