Skip to content
Snippets Groups Projects
Commit b4ce9664 authored by tholok97's avatar tholok97
Browse files

#4 bandit also on test, pycodestyle also on test

parent 487f0782
No related branches found
No related tags found
No related merge requests found
Pipeline #70398 failed
......@@ -22,14 +22,14 @@ job_lint_bandit:
image: morkolai/soitool-ci
script:
- bandit --version
- bandit -r soitool
- bandit -r soitool test
job_lint_pydocstyle:
stage: lint
image: morkolai/soitool-ci
script:
- pydocstyle --version
- pydocstyle --convention=numpy soitool
- pydocstyle --match '.*.py' --convention=numpy soitool test
job_test_gui_ubuntu_vnc:
stage: test
......
"""Tester koden vår."""
"""Test CoolWidget"""
"""Test CoolWidget."""
import unittest
import sys
......@@ -23,7 +23,7 @@ app = QtWidgets.QApplication(sys.argv)
def wait(msec):
"""Venter msec millisekunder
"""Venter msec millisekunder.
Bruker https://stackoverflow.com/a/34745326/3545896
......@@ -32,24 +32,23 @@ def wait(msec):
msec : number
msec to wait
"""
end = datetime_.now() + timedelta(milliseconds=msec)
while datetime_.now() < end:
app.processEvents()
class TestMain(unittest.TestCase):
"""TestCase for main"""
"""TestCase for main."""
def setUp(self):
"""Forbereder widget for testing"""
"""Forbereder widget for testing."""
self.test_text1 = "A bad boy"
self.test_text2 = "Hei Anders!"
self.widget = main.CoolWidget(self.test_text1)
self.widget.show()
def test_starts_up(self):
"""Test at widget kan starte opp"""
"""Test at widget kan starte opp."""
self.assertEqual(
self.widget.qlabel.text(),
self.test_text1,
......@@ -57,7 +56,7 @@ class TestMain(unittest.TestCase):
self.assertTrue(self.widget.isVisible())
def test_change_text_ok(self):
"""Test at endring av tekst funker"""
"""Test at endring av tekst funker."""
def change_text_and_ok():
while self.widget.dlg_input is None:
......@@ -75,7 +74,7 @@ class TestMain(unittest.TestCase):
)
def test_change_text_not_ok(self):
"""Test at avbrytelse av endring av tekster ikke endrer tekst"""
"""Test at avbrytelse av endring av tekster ikke endrer tekst."""
def accept_popup():
QtTest.QTest.keyClick(app.activeModalWidget(), QtCore.Qt.Key_Enter)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment