mirror of
https://github.com/naruxde/revpimodio2.git
synced 2025-11-08 13:53:53 +01:00
test: Cleanup tests and use relative imports
This commit is contained in:
5
tests/common/__init__.py
Normal file
5
tests/common/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Init file for test group."""
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2024 Sven Sager"
|
||||
__license__ = "GPLv2"
|
||||
@@ -6,7 +6,7 @@ __license__ = "GPLv2"
|
||||
|
||||
from os.path import dirname
|
||||
|
||||
from tests import TestRevPiModIO
|
||||
from .. import TestRevPiModIO
|
||||
|
||||
|
||||
class TestConfigRscBugs(TestRevPiModIO):
|
||||
|
||||
@@ -8,7 +8,7 @@ from os.path import dirname
|
||||
|
||||
from revpimodio2 import OUT, MEM, INP
|
||||
from revpimodio2.device import Virtual, Base
|
||||
from tests import TestRevPiModIO
|
||||
from .. import TestRevPiModIO
|
||||
|
||||
|
||||
class TestDevicesModule(TestRevPiModIO):
|
||||
|
||||
@@ -9,7 +9,7 @@ from os.path import join, dirname
|
||||
from shutil import copyfile
|
||||
|
||||
import revpimodio2
|
||||
from tests import TestRevPiModIO
|
||||
from .. import TestRevPiModIO
|
||||
|
||||
|
||||
class TestInitModio(TestRevPiModIO):
|
||||
|
||||
@@ -9,7 +9,7 @@ from os.path import join, dirname
|
||||
from signal import SIGINT
|
||||
from threading import Event
|
||||
|
||||
from tests import TestRevPiModIO
|
||||
from .. import TestRevPiModIO
|
||||
|
||||
|
||||
class TestModioClassBasics(TestRevPiModIO):
|
||||
|
||||
5
tests/compact/__init__.py
Normal file
5
tests/compact/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Init file for test group."""
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2024 Sven Sager"
|
||||
__license__ = "GPLv2"
|
||||
@@ -4,10 +4,10 @@ __author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2024 Sven Sager"
|
||||
__license__ = "GPLv2"
|
||||
|
||||
from os.path import join, dirname
|
||||
from os.path import dirname
|
||||
|
||||
import revpimodio2
|
||||
from tests import TestRevPiModIO
|
||||
from .. import TestRevPiModIO
|
||||
|
||||
|
||||
class TestCompact(TestRevPiModIO):
|
||||
|
||||
5
tests/cycleloop/__init__.py
Normal file
5
tests/cycleloop/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Init file for test group."""
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2024 Sven Sager"
|
||||
__license__ = "GPLv2"
|
||||
@@ -8,8 +8,8 @@ from os.path import dirname, join
|
||||
from time import sleep
|
||||
|
||||
import revpimodio2
|
||||
from tests import TestRevPiModIO
|
||||
from tests.helper import ExitThread
|
||||
from .. import TestRevPiModIO
|
||||
from ..helper import ExitThread
|
||||
|
||||
event_data = (None, None)
|
||||
|
||||
|
||||
5
tests/events_and_signals/__init__.py
Normal file
5
tests/events_and_signals/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Init file for test group."""
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2024 Sven Sager"
|
||||
__license__ = "GPLv2"
|
||||
@@ -9,8 +9,8 @@ from threading import Event
|
||||
from time import sleep
|
||||
|
||||
from revpimodio2 import RISING, FALLING
|
||||
from tests import TestRevPiModIO
|
||||
from tests.helper import ChangeThread
|
||||
from .. import TestRevPiModIO
|
||||
from ..helper import ChangeThread
|
||||
|
||||
event_data = (None, None)
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ __license__ = "GPLv2"
|
||||
|
||||
from os.path import dirname
|
||||
|
||||
from tests import TestRevPiModIO
|
||||
from tests.helper import ExitSignal
|
||||
from .. import TestRevPiModIO
|
||||
from ..helper import ExitSignal
|
||||
|
||||
|
||||
class TestSignals(TestRevPiModIO):
|
||||
|
||||
5
tests/flat/__init__.py
Normal file
5
tests/flat/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Init file for test group."""
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2024 Sven Sager"
|
||||
__license__ = "GPLv2"
|
||||
@@ -7,7 +7,7 @@ __license__ = "GPLv2"
|
||||
from os.path import dirname
|
||||
|
||||
import revpimodio2
|
||||
from tests import TestRevPiModIO
|
||||
from .. import TestRevPiModIO
|
||||
|
||||
|
||||
class TestFlat(TestRevPiModIO):
|
||||
|
||||
5
tests/io_tests/__init__.py
Normal file
5
tests/io_tests/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Init file for test group."""
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2024 Sven Sager"
|
||||
__license__ = "GPLv2"
|
||||
@@ -7,7 +7,7 @@ __license__ = "GPLv2"
|
||||
from os.path import dirname
|
||||
|
||||
from revpimodio2 import OUT
|
||||
from tests import TestRevPiModIO
|
||||
from .. import TestRevPiModIO
|
||||
|
||||
|
||||
class TestIoFunctions(TestRevPiModIO):
|
||||
|
||||
@@ -7,7 +7,7 @@ __license__ = "GPLv2"
|
||||
from os.path import dirname
|
||||
|
||||
from revpimodio2.io import IntIOCounter
|
||||
from tests import TestRevPiModIO
|
||||
from .. import TestRevPiModIO
|
||||
|
||||
|
||||
class TestIos(TestRevPiModIO):
|
||||
|
||||
5
tests/mainloop/__init__.py
Normal file
5
tests/mainloop/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Init file for test group."""
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2024 Sven Sager"
|
||||
__license__ = "GPLv2"
|
||||
@@ -8,8 +8,8 @@ from os.path import dirname
|
||||
from time import sleep
|
||||
|
||||
import revpimodio2
|
||||
from tests import TestRevPiModIO
|
||||
from tests.helper import ExitThread, ChangeThread
|
||||
from .. import TestRevPiModIO
|
||||
from ..helper import ExitThread, ChangeThread
|
||||
|
||||
event_data = (None, None)
|
||||
|
||||
|
||||
5
tests/replace_io/__init__.py
Normal file
5
tests/replace_io/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Init file for test group."""
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2024 Sven Sager"
|
||||
__license__ = "GPLv2"
|
||||
@@ -7,7 +7,7 @@ __license__ = "GPLv2"
|
||||
from os.path import join, dirname
|
||||
|
||||
from revpimodio2.io import IntIOReplaceable
|
||||
from tests import TestRevPiModIO
|
||||
from .. import TestRevPiModIO
|
||||
|
||||
|
||||
class TestReplaceIO(TestRevPiModIO):
|
||||
@@ -148,20 +148,16 @@ class TestReplaceIO(TestRevPiModIO):
|
||||
|
||||
def test_replace_io_file_fail(self):
|
||||
with self.assertRaises(RuntimeError):
|
||||
rpi = self.modio(replace_io_file=join(self.data_dir, "replace_io_fail.conf"))
|
||||
self.modio(replace_io_file=join(self.data_dir, "replace_io_fail.conf"))
|
||||
with self.assertRaises(RuntimeError):
|
||||
rpi = self.modio(replace_io_file="no_file_nonono")
|
||||
self.modio(replace_io_file="no_file_nonono")
|
||||
with self.assertRaises(RuntimeError):
|
||||
rpi = self.modio(replace_io_file=join(self.data_dir, "replace_io_failformat.conf"))
|
||||
self.modio(replace_io_file=join(self.data_dir, "replace_io_failformat.conf"))
|
||||
with self.assertRaises(ValueError):
|
||||
rpi = self.modio(
|
||||
replace_io_file=join(self.data_dir, "replace_io_faildefaultvalue_bool.conf")
|
||||
)
|
||||
self.modio(replace_io_file=join(self.data_dir, "replace_io_faildefaultvalue_bool.conf"))
|
||||
with self.assertRaises(ValueError):
|
||||
rpi = self.modio(
|
||||
replace_io_file=join(self.data_dir, "replace_io_faildefaultvalue_int.conf")
|
||||
)
|
||||
self.modio(replace_io_file=join(self.data_dir, "replace_io_faildefaultvalue_int.conf"))
|
||||
with self.assertRaises(ValueError):
|
||||
rpi = self.modio(replace_io_file=join(self.data_dir, "replace_io_failbit_int.conf"))
|
||||
self.modio(replace_io_file=join(self.data_dir, "replace_io_failbit_int.conf"))
|
||||
with self.assertRaisesRegex(ValueError, r"defaultvalue to bytes"):
|
||||
rpi = self.modio(replace_io_file=join(self.data_dir, "replace_io_bytes_fail.conf"))
|
||||
self.modio(replace_io_file=join(self.data_dir, "replace_io_bytes_fail.conf"))
|
||||
|
||||
5
tests/revpi3/__init__.py
Normal file
5
tests/revpi3/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Init file for test group."""
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2024 Sven Sager"
|
||||
__license__ = "GPLv2"
|
||||
@@ -7,7 +7,7 @@ __license__ = "GPLv2"
|
||||
from os.path import dirname
|
||||
|
||||
from revpimodio2 import BLUE
|
||||
from tests import TestRevPiModIO
|
||||
from .. import TestRevPiModIO
|
||||
|
||||
|
||||
class TestRevPiConnect(TestRevPiModIO):
|
||||
|
||||
@@ -8,7 +8,7 @@ from os.path import dirname
|
||||
|
||||
from revpimodio2 import RED, GREEN, OFF, BLUE
|
||||
from revpimodio2.io import IOBase, IntIO
|
||||
from tests import TestRevPiModIO
|
||||
from .. import TestRevPiModIO
|
||||
|
||||
|
||||
class TestRevPiCore(TestRevPiModIO):
|
||||
|
||||
5
tests/revpi4/__init__.py
Normal file
5
tests/revpi4/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Init file for test group."""
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2024 Sven Sager"
|
||||
__license__ = "GPLv2"
|
||||
@@ -4,10 +4,10 @@ __author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2024 Sven Sager"
|
||||
__license__ = "GPLv2"
|
||||
|
||||
from os.path import join, dirname
|
||||
from os.path import dirname
|
||||
|
||||
import revpimodio2
|
||||
from tests import TestRevPiModIO
|
||||
from .. import TestRevPiModIO
|
||||
|
||||
|
||||
class TestRevPi4(TestRevPiModIO):
|
||||
|
||||
Reference in New Issue
Block a user