Completed
Pull Request — master (#6)
by Olivier
54s
created

TestAttrsWidget   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
dl 0
loc 13
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A test_add_folder() 0 3 1
A tearDown() 0 2 1
1
2
import unittest
3
import sys
4
print("SYS:PATH", sys.path)
5
sys.path.insert(0, "python-opcua")
6
sys.path.insert(0, ".")
7
8
from opcua import ua, Server
9
10
from PyQt5.QtCore import QTimer, QSettings, QModelIndex, Qt, QCoreApplication
11
from PyQt5.QtWidgets import QApplication, QTreeView
12
from PyQt5.QtTest import QTest
13
14
from uawidgets.attrs_widget import AttrsWidget
15
16
17
class TestAttrsWidget(unittest.TestCase):
18
    def setUp(self):
19
        self.server = Server()
20
        self.server.set_endpoint("opc.tcp://0.0.0.0:4840/freeopcua/server/")
21
        self.server.start()
22
        self.widget = AttrsWidget(QTreeView())
23
24
    def tearDown(self):
25
        self.server.stop()
26
27
    def test_add_folder(self):
28
        objects = self.server.nodes.objects
29
        self.widget.show_attrs(objects)
30
31
32
33
if __name__ == "__main__":
34
    app = QApplication(sys.argv)
35
    unittest.main()
36
37
38