tests/tools/test_application.py
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 15 Sep 2017 19:51:31 +0300
changeset 1809 3f0a552549d1
parent 1808 b4764ebb352d
child 1816 724722c03db4
permissions -rw-r--r--
run separate test on every project instead of one big long test all projects
1808
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
     1
#!/usr/bin/env python
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
     2
# -*- coding: utf-8 -*-
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
     3
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
     4
# This file is part of Beremiz, a Integrated Development Environment for
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
     5
# programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
     6
#
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
     7
# Copyright (C) 2017: Andrey Skvortsov
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
     8
#
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
     9
# See COPYING file for copyrights details.
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    10
#
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    11
# This program is free software; you can redistribute it and/or
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    12
# modify it under the terms of the GNU General Public License
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    13
# as published by the Free Software Foundation; either version 2
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    14
# of the License, or (at your option) any later version.
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    15
#
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    16
# This program is distributed in the hope that it will be useful,
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    19
# GNU General Public License for more details.
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    20
#
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    21
# You should have received a copy of the GNU General Public License
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    22
# along with this program; if not, write to the Free Software
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    23
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    24
1796
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    25
import os
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    26
import sys
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    27
import unittest
1809
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
    28
import pytest
1796
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    29
import wx
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    30
import time
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    31
import traceback
1809
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
    32
import ddt
1796
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    33
1808
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    34
import conftest
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    35
import Beremiz
1796
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    36
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    37
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    38
class UserApplicationTest(unittest.TestCase):
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    39
    def InstallExceptionHandler(self):
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    40
        def handle_exception(e_type, e_value, e_traceback):
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    41
            # traceback.print_exception(e_type, e_value, e_traceback)
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    42
            self.exc_info = [e_type, e_value, e_traceback]
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    43
        self.exc_info = None
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    44
        self.old_excepthook = sys.excepthook
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    45
        sys.excepthook = handle_exception
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    46
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    47
    def StartApp(self):
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    48
        self.app = None
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    49
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    50
    def FinishApp(self):
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    51
        wx.CallAfter(self.app.frame.Close)
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    52
        self.app.MainLoop()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    53
        self.app = None
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    54
1809
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
    55
    def setUp(self):
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
    56
        self.app = None
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
    57
1796
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    58
    def tearDown(self):
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    59
        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
    60
            self.FinishApp()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    61
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    62
    def RunUIActions(self, actions):
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    63
        for act in actions:
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    64
            wx.CallAfter(*act)
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    65
            self.ProcessEvents()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    66
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    67
    def CheckForErrors(self):
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    68
        if self.exc_info is not None:
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    69
            # reraise catched previously exception
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    70
            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
    71
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    72
    def ProcessEvents(self):
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    73
        for i in range(0, 30):
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    74
            self.CheckForErrors()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    75
            wx.Yield()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    76
            time.sleep(0.01)
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    77
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    78
1809
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
    79
@ddt.ddt
1796
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    80
class BeremizApplicationTest(UserApplicationTest):
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    81
    """Test Beremiz as whole application"""
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    82
    def StartApp(self):
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    83
        self.app = Beremiz.BeremizIDELauncher()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    84
        # disable default exception handler in Beremiz
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    85
        self.app.InstallExceptionHandler = lambda: None
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    86
        self.InstallExceptionHandler()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    87
        self.app.PreStart()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    88
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    89
    def FinishApp(self):
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    90
        wx.CallAfter(self.app.frame.Close)
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    91
        self.app.MainLoop()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    92
        time.sleep(1)
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    93
        self.app = None
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    94
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    95
    def OpenAllProjectElements(self):
1808
b4764ebb352d move configuration for test environment into separate file conftest.py
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1796
diff changeset
    96
        """Open editor for every object in the project tree"""
1796
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    97
        self.app.frame.ProjectTree.ExpandAll()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    98
        self.ProcessEvents()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    99
        item = self.app.frame.ProjectTree.GetRootItem()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   100
        while item is not None:
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   101
            self.app.frame.ProjectTree.SelectItem(item, True)
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   102
            self.ProcessEvents()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   103
            id = self.app.frame.ProjectTree.GetId()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   104
            event = wx.lib.agw.customtreectrl.TreeEvent(
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   105
                wx.lib.agw.customtreectrl.wxEVT_TREE_ITEM_ACTIVATED,
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   106
                id, item)
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   107
            self.app.frame.OnProjectTreeItemActivated(event)
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   108
            self.ProcessEvents()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   109
            item = self.app.frame.ProjectTree.GetNextVisible(item)
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   110
1809
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   111
    def CheckTestProject(self, name):
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   112
        project = self.GetProjectPath(name)
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   113
        print "Testing example " + name
1796
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   114
        sys.argv = ["", project]
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   115
        self.StartApp()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   116
        self.OpenAllProjectElements()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   117
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   118
        user_actions = [
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   119
            [self.app.frame.SwitchFullScrMode, None],
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   120
            [self.app.frame.SwitchFullScrMode, None],
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   121
            [self.app.frame.CTR._Clean],
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   122
            [self.app.frame.CTR._Build],
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   123
            [self.app.frame.CTR._Connect],
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   124
            [self.app.frame.CTR._Transfer],
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   125
            [self.app.frame.CTR._Run],
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   126
            [self.app.frame.CTR._Stop],
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   127
            [self.app.frame.CTR._Disconnect],
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   128
        ]
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   129
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   130
        self.RunUIActions(user_actions)
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   131
        self.FinishApp()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   132
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   133
    def GetProjectPath(self, project):
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   134
        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
   135
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   136
    def testStartUp(self):
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   137
        """Checks whether the app starts and finishes correctly"""
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   138
        self.StartApp()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   139
        self.FinishApp()
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   140
1809
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   141
    @ddt.data(
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   142
        "first_steps",
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   143
        "logging",
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   144
        "svgui",
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   145
        "traffic_lights",
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   146
        "wxGlade",
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   147
        "python",
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   148
        "wiimote",
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   149
        "wxHMI",
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   150
    )
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   151
    @pytest.mark.timeout(30)
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   152
    def testCheckProject(self, name):
3f0a552549d1 run separate test on every project instead of one big long test all projects
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1808
diff changeset
   153
        self.CheckTestProject(name)
1796
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   154
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   155
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   156
if __name__ == '__main__':
4f7a0c40a7c3 add couple Beremiz application tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   157
    unittest.main()