author | Andrey Skvortsov <andrej.skvortzov@gmail.com> |
Tue, 12 Sep 2017 18:32:13 +0300 | |
changeset 1801 | 58ff55053518 |
parent 1796 | 4f7a0c40a7c3 |
child 1808 | b4764ebb352d |
permissions | -rw-r--r-- |
1796
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
1 |
import os |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
2 |
import sys |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
3 |
import unittest |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
4 |
import wx |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
5 |
import time |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
6 |
import traceback |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
7 |
from xvfbwrapper import Xvfb |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
8 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
9 |
vdisplay = None |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
10 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
11 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
12 |
def setUpModule(): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
13 |
vdisplay = Xvfb(width=1280, height=720) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
14 |
vdisplay.start() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
15 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
16 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
17 |
def tearDownModule(): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
18 |
if vdisplay is not None: |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
19 |
vdisplay.stop() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
20 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
21 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
22 |
class UserApplicationTest(unittest.TestCase): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
23 |
def InstallExceptionHandler(self): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
24 |
def handle_exception(e_type, e_value, e_traceback): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
25 |
# traceback.print_exception(e_type, e_value, e_traceback) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
26 |
self.exc_info = [e_type, e_value, e_traceback] |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
27 |
self.exc_info = None |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
28 |
self.old_excepthook = sys.excepthook |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
29 |
sys.excepthook = handle_exception |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
30 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
31 |
def StartApp(self): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
32 |
self.app = None |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
33 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
34 |
def FinishApp(self): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
35 |
wx.CallAfter(self.app.frame.Close) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
36 |
self.app.MainLoop() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
37 |
# time.sleep(0.2) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
38 |
self.app = None |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
39 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
40 |
def tearDown(self): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
41 |
if self.app is not None and self.app.frame is not None: |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
42 |
self.FinishApp() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
43 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
44 |
def RunUIActions(self, actions): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
45 |
for act in actions: |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
46 |
wx.CallAfter(*act) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
47 |
self.ProcessEvents() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
48 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
49 |
def CheckForErrors(self): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
50 |
if self.exc_info is not None: |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
51 |
# reraise catched previously exception |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
52 |
raise self.exc_info[0], self.exc_info[1], self.exc_info[2] |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
53 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
54 |
def ProcessEvents(self): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
55 |
for i in range(0, 30): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
56 |
self.CheckForErrors() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
57 |
wx.Yield() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
58 |
time.sleep(0.01) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
59 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
60 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
61 |
class BeremizApplicationTest(UserApplicationTest): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
62 |
"""Test Beremiz as whole application""" |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
63 |
def StartApp(self): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
64 |
self.app = Beremiz.BeremizIDELauncher() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
65 |
# disable default exception handler in Beremiz |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
66 |
self.app.InstallExceptionHandler = lambda: None |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
67 |
self.InstallExceptionHandler() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
68 |
self.app.PreStart() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
69 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
70 |
def FinishApp(self): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
71 |
wx.CallAfter(self.app.frame.Close) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
72 |
self.app.MainLoop() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
73 |
time.sleep(1) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
74 |
self.app = None |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
75 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
76 |
def OpenAllProjectElements(self): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
77 |
# open every object in the project tree |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
78 |
self.app.frame.ProjectTree.ExpandAll() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
79 |
self.ProcessEvents() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
80 |
item = self.app.frame.ProjectTree.GetRootItem() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
81 |
while item is not None: |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
82 |
self.app.frame.ProjectTree.SelectItem(item, True) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
83 |
self.ProcessEvents() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
84 |
id = self.app.frame.ProjectTree.GetId() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
85 |
event = wx.lib.agw.customtreectrl.TreeEvent( |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
86 |
wx.lib.agw.customtreectrl.wxEVT_TREE_ITEM_ACTIVATED, |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
87 |
id, item) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
88 |
self.app.frame.OnProjectTreeItemActivated(event) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
89 |
self.ProcessEvents() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
90 |
item = self.app.frame.ProjectTree.GetNextVisible(item) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
91 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
92 |
def CheckTestProject(self, project): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
93 |
sys.argv = ["", project] |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
94 |
self.StartApp() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
95 |
self.OpenAllProjectElements() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
96 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
97 |
user_actions = [ |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
98 |
[self.app.frame.SwitchFullScrMode, None], |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
99 |
[self.app.frame.SwitchFullScrMode, None], |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
100 |
[self.app.frame.CTR._Clean], |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
101 |
[self.app.frame.CTR._Build], |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
102 |
[self.app.frame.CTR._Connect], |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
103 |
[self.app.frame.CTR._Transfer], |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
104 |
[self.app.frame.CTR._Run], |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
105 |
[self.app.frame.CTR._Stop], |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
106 |
[self.app.frame.CTR._Disconnect], |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
107 |
] |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
108 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
109 |
# user_actions.append([self.app.frame.OnCloseProjectMenu, None]) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
110 |
self.RunUIActions(user_actions) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
111 |
self.FinishApp() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
112 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
113 |
def GetProjectPath(self, project): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
114 |
return os.path.abspath(os.path.join(os.path.dirname(__file__), "..", project)) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
115 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
116 |
# @unittest.skip("") |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
117 |
def testStartUp(self): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
118 |
"""Checks whether the app starts and finishes correctly""" |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
119 |
self.StartApp() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
120 |
self.FinishApp() |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
121 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
122 |
# @unittest.skip("") |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
123 |
def testOpenExampleProjects(self): |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
124 |
"""Opens, builds and runs user PLC examples from tests directory""" |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
125 |
prj = [ |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
126 |
"first_steps", |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
127 |
"logging", |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
128 |
"svgui", |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
129 |
"traffic_lights", |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
130 |
"wxGlade", |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
131 |
"python", |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
132 |
"wiimote", |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
133 |
"wxHMI", |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
134 |
] |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
135 |
for name in prj: |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
136 |
project = self.GetProjectPath(name) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
137 |
print "Testing example " + name |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
138 |
self.CheckTestProject(project) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
139 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
140 |
|
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
141 |
if __name__ == '__main__': |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
142 |
if __package__ is None: |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
143 |
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
144 |
global Beremiz |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
145 |
import Beremiz |
4f7a0c40a7c3
add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff
changeset
|
146 |
unittest.main() |