mirror of
https://github.com/jopohl/urh.git
synced 2026-03-09 17:56:48 +01:00
absolute paths in testing, to start tests from any directory
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
import sys
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
@@ -4,11 +4,11 @@ import unittest
|
||||
from urh.dev.PCAP import PCAP
|
||||
from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer
|
||||
from urh.signalprocessing.Signal import Signal
|
||||
|
||||
from tests.utils_testing import get_path_for_data_file
|
||||
|
||||
class TestPCAP(unittest.TestCase):
|
||||
def test_write(self):
|
||||
signal = Signal("./data/ask.complex", "ASK-Test")
|
||||
signal = Signal(get_path_for_data_file("ask.complex"), "ASK-Test")
|
||||
signal.modulation_type = 0
|
||||
signal.bit_len = 295
|
||||
signal.qad_center = -0.1667
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from PyQt5.QtTest import QTest
|
||||
|
||||
from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer
|
||||
from urh.signalprocessing.Signal import Signal
|
||||
|
||||
from tests.utils_testing import get_path_for_data_file
|
||||
|
||||
class TestRSSI(unittest.TestCase):
|
||||
# Testmethode muss immer mit Präfix test_* starten
|
||||
def test_get_rssi_of_message(self):
|
||||
signal = Signal(os.path.realpath(os.path.join(os.curdir, "data", "two_participants.complex")), "RSSI-Test")
|
||||
signal = Signal(get_path_for_data_file("two_participants.complex"), "RSSI-Test")
|
||||
signal.modulation_type = 1
|
||||
signal.bit_len = 100
|
||||
signal.qad_center = -0.0507
|
||||
|
||||
@@ -3,10 +3,12 @@ import unittest
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtTest import QTest
|
||||
|
||||
import tests.startApp
|
||||
import tests.utils_testing
|
||||
from urh.controller.MainController import MainController
|
||||
|
||||
app = tests.startApp.app
|
||||
from tests.utils_testing import get_path_for_data_file
|
||||
|
||||
app = tests.utils_testing.app
|
||||
|
||||
|
||||
class TestAnalysisTabGUI(unittest.TestCase):
|
||||
@@ -15,12 +17,12 @@ class TestAnalysisTabGUI(unittest.TestCase):
|
||||
self.cfc = self.form.compare_frame_controller
|
||||
|
||||
def test_analyze_button_fsk(self):
|
||||
self.form.add_signalfile("./data/fsk.complex")
|
||||
self.form.add_signalfile(get_path_for_data_file("fsk.complex"))
|
||||
self.cfc.ui.btnAnalyze.click()
|
||||
self.assertTrue(True)
|
||||
|
||||
def test_analyze_button_enocean(self):
|
||||
self.form.add_signalfile("./data/enocean.complex")
|
||||
self.form.add_signalfile(get_path_for_data_file("enocean.complex"))
|
||||
w = self.form.signal_tab_controller.signal_frames[0].ui.spinBoxCenterOffset
|
||||
w.setValue(0)
|
||||
QTest.keyClick(w, Qt.Key_Enter)
|
||||
|
||||
@@ -7,12 +7,12 @@ from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer
|
||||
from urh.signalprocessing.Message import Message
|
||||
from urh.signalprocessing.Ruleset import Rule, Ruleset, Mode
|
||||
from urh.signalprocessing.encoder import Encoder
|
||||
|
||||
from tests.utils_testing import get_path_for_data_file
|
||||
|
||||
class TestAutoAssignments(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.protocol = ProtocolAnalyzer(None)
|
||||
with open("./data/decoded_bits.txt") as f:
|
||||
with open(get_path_for_data_file("decoded_bits.txt")) as f:
|
||||
for line in f:
|
||||
self.protocol.messages.append(Message.from_plain_bits_str(line.replace("\n", ""), {}))
|
||||
self.protocol.messages[-1].message_type = self.protocol.default_message_type
|
||||
@@ -106,7 +106,7 @@ class TestAutoAssignments(unittest.TestCase):
|
||||
|
||||
def test_assign_decodings(self):
|
||||
self.undecoded_protocol = ProtocolAnalyzer(None)
|
||||
with open("./data/undecoded.txt") as f:
|
||||
with open(get_path_for_data_file("undecoded.txt")) as f:
|
||||
for line in f:
|
||||
self.undecoded_protocol.messages.append(Message.from_plain_bits_str(line.replace("\n", ""), {}))
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import unittest
|
||||
|
||||
from urh.signalprocessing.Signal import Signal
|
||||
|
||||
from tests.utils_testing import get_path_for_data_file
|
||||
|
||||
class TestAutodetections(unittest.TestCase):
|
||||
# Testmethode muss immer mit Präfix test_* starten
|
||||
def test_auto_detect_esaver(self):
|
||||
signal = Signal("./data/esaver.complex", "ESaver")
|
||||
signal = Signal(get_path_for_data_file("esaver.complex"), "ESaver")
|
||||
signal.modulation_type = 1
|
||||
signal.qad_center = signal.estimate_qad_center()
|
||||
self.assertTrue(0.24 < signal.qad_center < 0.5)
|
||||
@@ -14,7 +14,7 @@ class TestAutodetections(unittest.TestCase):
|
||||
self.assertTrue(80 <= signal.bit_len <= 120)
|
||||
|
||||
def test_auto_detect_elektromaten(self):
|
||||
signal = Signal("./data/elektromaten.complex", "Elektromaten")
|
||||
signal = Signal(get_path_for_data_file("elektromaten.complex"), "Elektromaten")
|
||||
signal.modulation_type = 0
|
||||
signal.qad_center = signal.estimate_qad_center()
|
||||
self.assertTrue(0.0015 < signal.qad_center < 0.0140)
|
||||
@@ -22,7 +22,7 @@ class TestAutodetections(unittest.TestCase):
|
||||
self.assertTrue(270 <= signal.bit_len <= 330)
|
||||
|
||||
def test_auto_detect_fsk(self):
|
||||
signal = Signal("./data/fsk.complex", "FSK")
|
||||
signal = Signal(get_path_for_data_file("fsk.complex"), "FSK")
|
||||
signal.modulation_type = 1
|
||||
signal.qad_center = signal.estimate_qad_center()
|
||||
self.assertTrue(-0.1 <= signal.qad_center <= 0)
|
||||
@@ -30,7 +30,7 @@ class TestAutodetections(unittest.TestCase):
|
||||
self.assertTrue(90 <= signal.bit_len <= 110)
|
||||
|
||||
def test_auto_detect_ask(self):
|
||||
signal = Signal("./data/ask.complex", "ASK")
|
||||
signal = Signal(get_path_for_data_file("ask.complex"), "ASK")
|
||||
signal.modulation_type = 0
|
||||
signal.qad_center = signal.estimate_qad_center()
|
||||
self.assertTrue(0 <= signal.qad_center <= 0.0036)
|
||||
@@ -38,7 +38,7 @@ class TestAutodetections(unittest.TestCase):
|
||||
self.assertTrue(270 <= signal.bit_len <= 330)
|
||||
|
||||
def test_qad_stays_the_same(self):
|
||||
signal = Signal("./data/esaver.complex", "ESaver")
|
||||
signal = Signal(get_path_for_data_file("esaver.complex"), "ESaver")
|
||||
signal.modulation_type = 1
|
||||
signal.qad_center = signal.estimate_qad_center()
|
||||
qad_center = signal.qad_center
|
||||
|
||||
@@ -16,11 +16,8 @@ from urh.signalprocessing.Participant import Participant
|
||||
from urh.signalprocessing.ProtocoLabel import ProtocolLabel
|
||||
from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer
|
||||
from urh.signalprocessing.Message import Message
|
||||
from tests.utils_testing import get_path_for_data_file
|
||||
|
||||
|
||||
|
||||
|
||||
from urh.cythonext import util
|
||||
class TestAWRE(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.field_types = FieldType.default_field_types()
|
||||
@@ -33,7 +30,7 @@ class TestAWRE(unittest.TestCase):
|
||||
self.src_address_field_type = self.__field_type_with_function(self.field_types, FieldType.Function.SRC_ADDRESS)
|
||||
|
||||
self.protocol = ProtocolAnalyzer(None)
|
||||
with open("./data/awre_consistent_addresses.txt") as f:
|
||||
with open(get_path_for_data_file("awre_consistent_addresses.txt")) as f:
|
||||
for line in f:
|
||||
self.protocol.messages.append(Message.from_plain_bits_str(line.replace("\n", ""), {}))
|
||||
self.protocol.messages[-1].message_type = self.protocol.default_message_type
|
||||
@@ -48,7 +45,7 @@ class TestAWRE(unittest.TestCase):
|
||||
self.participants = [alice, bob]
|
||||
|
||||
self.zero_crc_protocol = ProtocolAnalyzer(None)
|
||||
with open("./data/awre_zeroed_crc.txt") as f:
|
||||
with open(get_path_for_data_file("awre_zeroed_crc.txt")) as f:
|
||||
for line in f:
|
||||
self.zero_crc_protocol.messages.append(Message.from_plain_bits_str(line.replace("\n", ""), {}))
|
||||
self.zero_crc_protocol.messages[-1].message_type = self.protocol.default_message_type
|
||||
@@ -135,7 +132,7 @@ class TestAWRE(unittest.TestCase):
|
||||
|
||||
def test_format_finding_enocean(self):
|
||||
enocean_protocol = ProtocolAnalyzer(None)
|
||||
with open("./data/enocean_bits.txt") as f:
|
||||
with open(get_path_for_data_file("enocean_bits.txt")) as f:
|
||||
for line in f:
|
||||
enocean_protocol.messages.append(Message.from_plain_bits_str(line.replace("\n", ""), {}))
|
||||
enocean_protocol.messages[-1].message_type = enocean_protocol.default_message_type
|
||||
|
||||
@@ -4,13 +4,14 @@ from PyQt5.QtTest import QTest
|
||||
|
||||
from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer
|
||||
from urh.signalprocessing.Signal import Signal
|
||||
from tests.utils_testing import get_path_for_data_file
|
||||
|
||||
|
||||
class TestDemodulations(unittest.TestCase):
|
||||
|
||||
# Testmethode muss immer mit Präfix test_* starten
|
||||
def test_ask(self):
|
||||
signal = Signal("./data/ask.complex", "ASK-Test")
|
||||
signal = Signal(get_path_for_data_file("ask.complex"), "ASK-Test")
|
||||
signal.modulation_type = 0
|
||||
signal.bit_len = 295
|
||||
signal.qad_center = -0.1667
|
||||
@@ -21,7 +22,7 @@ class TestDemodulations(unittest.TestCase):
|
||||
self.assertTrue(proto_analyzer.plain_bits_str[0].startswith("1011001001011011011011011011011011001000000"))
|
||||
|
||||
def test_fsk(self):
|
||||
signal = Signal("./data/fsk.complex", "FSK-Test")
|
||||
signal = Signal(get_path_for_data_file("fsk.complex"), "FSK-Test")
|
||||
signal.modulation_type = 1
|
||||
signal.bit_len = 100
|
||||
signal.qad_center = 0
|
||||
@@ -32,7 +33,7 @@ class TestDemodulations(unittest.TestCase):
|
||||
"101010101010101010101010101010101100011000100110110001100010011011110100110111000001110110011000111011101111011110100100001001111001100110011100110100100011100111010011111100011")
|
||||
|
||||
def test_psk(self):
|
||||
signal = Signal("./data/psk_gen_noisy.complex", "PSK-Test")
|
||||
signal = Signal(get_path_for_data_file("psk_gen_noisy.complex"), "PSK-Test")
|
||||
signal.modulation_type = 2
|
||||
signal.bit_len = 300
|
||||
signal.qad_center = 0.0281
|
||||
|
||||
@@ -3,13 +3,13 @@ import unittest
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtTest import QTest
|
||||
|
||||
import tests.startApp
|
||||
import tests.utils_testing
|
||||
from urh import constants
|
||||
from urh.controller.FuzzingDialogController import FuzzingDialogController
|
||||
from urh.controller.MainController import MainController
|
||||
from urh.signalprocessing.encoder import Encoder
|
||||
|
||||
app = tests.startApp.app
|
||||
from tests.utils_testing import get_path_for_data_file
|
||||
app = tests.utils_testing.app
|
||||
|
||||
|
||||
class TestFuzzing(unittest.TestCase):
|
||||
@@ -18,7 +18,7 @@ class TestFuzzing(unittest.TestCase):
|
||||
constants.SETTINGS.setValue('rel_symbol_length', 0) # Disable Symbols for this Test
|
||||
|
||||
self.form = MainController()
|
||||
self.form.add_signalfile("./data/steckdose_anlernen.complex")
|
||||
self.form.add_signalfile(get_path_for_data_file("steckdose_anlernen.complex"))
|
||||
self.form.signal_tab_controller.signal_frames[0].ui.spinBoxNoiseTreshold.setValue(0.06)
|
||||
self.form.signal_tab_controller.signal_frames[0].ui.spinBoxNoiseTreshold.editingFinished.emit()
|
||||
self.form.signal_tab_controller.signal_frames[0].ui.spinBoxCenterOffset.setValue(-0.0127)
|
||||
|
||||
@@ -5,10 +5,10 @@ from PyQt5.QtCore import QDir
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtTest import QTest
|
||||
|
||||
import tests.startApp
|
||||
import tests.utils_testing
|
||||
from urh.controller.MainController import MainController
|
||||
|
||||
app = tests.startApp.app
|
||||
from tests.utils_testing import get_path_for_data_file
|
||||
app = tests.utils_testing.app
|
||||
|
||||
|
||||
class TestGenerator(unittest.TestCase):
|
||||
@@ -26,7 +26,7 @@ class TestGenerator(unittest.TestCase):
|
||||
|
||||
"""
|
||||
# Load a Signal
|
||||
self.form.add_signalfile("./data/ask.complex")
|
||||
self.form.add_signalfile(get_path_for_data_file("ask.complex"))
|
||||
sframe = self.form.signal_tab_controller.signal_frames[0]
|
||||
sframe.ui.cbModulationType.setCurrentIndex(0) # ASK
|
||||
sframe.ui.spinBoxInfoLen.setValue(295)
|
||||
@@ -80,7 +80,7 @@ class TestGenerator(unittest.TestCase):
|
||||
self.assertTrue(proto.startswith(gen_proto))
|
||||
|
||||
def test_close_signal(self):
|
||||
self.form.add_signalfile("./data/ask.complex")
|
||||
self.form.add_signalfile(get_path_for_data_file("ask.complex"))
|
||||
sframe = self.form.signal_tab_controller.signal_frames[0]
|
||||
sframe.ui.cbModulationType.setCurrentIndex(0) # ASK
|
||||
sframe.ui.spinBoxInfoLen.setValue(295)
|
||||
|
||||
@@ -4,12 +4,12 @@ import unittest
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtTest import QTest
|
||||
|
||||
import tests.startApp
|
||||
import tests.utils_testing
|
||||
from urh.controller.MainController import MainController
|
||||
from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer
|
||||
from urh.signalprocessing.Message import Message
|
||||
|
||||
app = tests.startApp.app
|
||||
app = tests.utils_testing.app
|
||||
|
||||
|
||||
class TestGeneratorTable(unittest.TestCase):
|
||||
|
||||
@@ -3,11 +3,12 @@ import unittest
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtTest import QTest
|
||||
|
||||
import tests.startApp
|
||||
import tests.utils_testing
|
||||
from urh import constants
|
||||
from urh.controller.MainController import MainController
|
||||
from tests.utils_testing import get_path_for_data_file
|
||||
|
||||
app = tests.startApp.app
|
||||
app = tests.utils_testing.app
|
||||
|
||||
|
||||
class TestLabels(unittest.TestCase):
|
||||
@@ -16,7 +17,7 @@ class TestLabels(unittest.TestCase):
|
||||
constants.SETTINGS.setValue('rel_symbol_length', 0) # Disable Symbols for this Test
|
||||
|
||||
self.form = MainController()
|
||||
self.form.add_signalfile("./data/esaver.complex")
|
||||
self.form.add_signalfile(get_path_for_data_file("esaver.complex"))
|
||||
self.sframe = self.form.signal_tab_controller.signal_frames[0]
|
||||
self.cframe = self.form.compare_frame_controller
|
||||
self.cframe.ui.cbProtoView.setCurrentIndex(0)
|
||||
@@ -47,9 +48,7 @@ class TestLabels(unittest.TestCase):
|
||||
for i in range(13, self.cframe.protocol_model.col_count):
|
||||
self.assertTrue(self.cframe.ui.tblViewProtocol.isColumnHidden(i), msg = "Hex " + str(i))
|
||||
|
||||
|
||||
def test_generator_label(self):
|
||||
|
||||
labels = self.cframe.proto_analyzer.protocol_labels
|
||||
self.assertEqual(len(labels), 2)
|
||||
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
import unittest
|
||||
|
||||
import math
|
||||
from PyQt5.QtTest import QTest
|
||||
|
||||
import tests.utils_testing
|
||||
from urh import constants
|
||||
from urh.controller.MainController import MainController
|
||||
from urh.plugins.MessageBreak.MessageBreakPlugin import MessageBreakPlugin
|
||||
from urh.plugins.NetworkSDRInterface.NetworkSDRInterfacePlugin import NetworkSDRInterfacePlugin
|
||||
from urh.plugins.ZeroHide.ZeroHidePlugin import ZeroHidePlugin
|
||||
|
||||
__author__ = 'joe'
|
||||
from tests.utils_testing import get_path_for_data_file
|
||||
|
||||
import tests.startApp
|
||||
|
||||
app = tests.startApp.app
|
||||
app = tests.utils_testing.app
|
||||
|
||||
|
||||
class TestPlugins(unittest.TestCase):
|
||||
@@ -22,7 +19,7 @@ class TestPlugins(unittest.TestCase):
|
||||
constants.SETTINGS.setValue('rel_symbol_length', 0) # Disable Symbols for this Test
|
||||
|
||||
self.form = MainController()
|
||||
self.form.add_signalfile("./data/esaver.complex")
|
||||
self.form.add_signalfile(get_path_for_data_file("esaver.complex"))
|
||||
self.sframe = self.form.signal_tab_controller.signal_frames[0]
|
||||
self.cframe = self.form.compare_frame_controller
|
||||
self.gframe = self.form.generator_tab_controller
|
||||
@@ -58,7 +55,7 @@ class TestPlugins(unittest.TestCase):
|
||||
def test_zero_hide_plugin_function(self):
|
||||
zh = ZeroHidePlugin()
|
||||
zh.following_zeros = 3
|
||||
self.form.add_signalfile("./data/ask.complex")
|
||||
self.form.add_signalfile(get_path_for_data_file("ask.complex"))
|
||||
self.form.ui.tabWidget.setCurrentIndex(1)
|
||||
test_bits = "10110010010110110110110110110110110001000000"
|
||||
self.assertEqual(self.cframe.proto_analyzer.decoded_proto_bits_str[3], test_bits)
|
||||
|
||||
@@ -3,17 +3,17 @@ import unittest
|
||||
|
||||
from PyQt5.QtTest import QTest
|
||||
|
||||
import tests.startApp
|
||||
import tests.utils_testing
|
||||
from urh.controller.MainController import MainController
|
||||
from urh.signalprocessing.Modulator import Modulator
|
||||
|
||||
app = tests.startApp.app
|
||||
from tests.utils_testing import get_path_for_data_file
|
||||
app = tests.utils_testing.app
|
||||
|
||||
|
||||
class TestProjectManager(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.form = MainController()
|
||||
self.form.project_manager.set_project_folder("./data")
|
||||
self.form.project_manager.set_project_folder(get_path_for_data_file(""))
|
||||
self.cframe = self.form.compare_frame_controller
|
||||
self.gframe = self.form.generator_tab_controller
|
||||
|
||||
@@ -49,8 +49,8 @@ class TestProjectManager(unittest.TestCase):
|
||||
def test_close_all(self):
|
||||
self.form.close_all()
|
||||
QTest.qWait(1)
|
||||
self.form.add_signalfile("./data/ask.complex")
|
||||
self.form.add_signalfile("./data/fsk.complex")
|
||||
self.form.add_signalfile(get_path_for_data_file("ask.complex"))
|
||||
self.form.add_signalfile(get_path_for_data_file("fsk.complex"))
|
||||
self.assertEqual(self.form.signal_tab_controller.num_signals, 2)
|
||||
self.form.close_all()
|
||||
QTest.qWait(1)
|
||||
|
||||
@@ -5,11 +5,11 @@ from PyQt5.QtTest import QTest
|
||||
from urh import constants
|
||||
from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer
|
||||
from urh.signalprocessing.Signal import Signal
|
||||
|
||||
from tests.utils_testing import get_path_for_data_file
|
||||
|
||||
class TestProtocolAnalyzer(unittest.TestCase):
|
||||
def test_get_bit_sample_pos(self):
|
||||
signal = Signal("./data/ASK_mod.complex", "Bit sample pos test")
|
||||
signal = Signal(get_path_for_data_file("ASK_mod.complex"), "Bit sample pos test")
|
||||
signal.modulation_type = 0
|
||||
signal.bit_len = 100
|
||||
|
||||
@@ -20,7 +20,7 @@ class TestProtocolAnalyzer(unittest.TestCase):
|
||||
self.assertLess(pos, signal.num_samples, msg = i)
|
||||
|
||||
def test_fsk_freq_detection(self):
|
||||
s = Signal("./data/steckdose_anlernen.complex", "RWE")
|
||||
s = Signal(get_path_for_data_file("steckdose_anlernen.complex"), "RWE")
|
||||
s.noise_treshold = 0.06
|
||||
s.qad_center = 0
|
||||
s.bit_len = 100
|
||||
@@ -41,7 +41,7 @@ class TestProtocolAnalyzer(unittest.TestCase):
|
||||
def test_symbols(self):
|
||||
old_sym_len = constants.SETTINGS.value('rel_symbol_length', type=int)
|
||||
constants.SETTINGS.setValue('rel_symbol_length', 20) # Set Symbol length for this test
|
||||
s = Signal("./data/vw_symbols.complex", "VW")
|
||||
s = Signal(get_path_for_data_file("vw_symbols.complex"), "VW")
|
||||
s.noise_treshold = 0.0111
|
||||
s.qad_center = 0.0470
|
||||
s.bit_len = 500
|
||||
|
||||
@@ -4,12 +4,12 @@ import unittest
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtTest import QTest
|
||||
|
||||
import tests.startApp
|
||||
import tests.utils_testing
|
||||
from urh.controller.MainController import MainController
|
||||
from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer
|
||||
from urh.signalprocessing.Message import Message
|
||||
|
||||
app = tests.startApp.app
|
||||
app = tests.utils_testing.app
|
||||
|
||||
|
||||
class TestProtocolTable(unittest.TestCase):
|
||||
|
||||
@@ -4,6 +4,7 @@ from urh import constants
|
||||
from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer
|
||||
from urh.signalprocessing.Signal import Signal
|
||||
|
||||
from tests.utils_testing import get_path_for_data_file
|
||||
|
||||
class TestSignal(unittest.TestCase):
|
||||
def setUp(self):
|
||||
@@ -11,7 +12,7 @@ class TestSignal(unittest.TestCase):
|
||||
constants.SETTINGS.setValue('rel_symbol_length', 0) # Disable Symbols for this Test
|
||||
|
||||
def test_freq_detection(self):
|
||||
s = Signal("./data/steckdose_anlernen.complex", "RWE")
|
||||
s = Signal(get_path_for_data_file("steckdose_anlernen.complex"), "RWE")
|
||||
s.noise_treshold = 0.06
|
||||
s.qad_center = 0
|
||||
s.bit_len = 100
|
||||
|
||||
@@ -2,10 +2,10 @@ import unittest
|
||||
|
||||
from PyQt5.QtTest import QTest
|
||||
|
||||
import tests.startApp
|
||||
import tests.utils_testing
|
||||
from urh.controller.MainController import MainController
|
||||
|
||||
app = tests.startApp.app
|
||||
from tests.utils_testing import get_path_for_data_file
|
||||
app = tests.utils_testing.app
|
||||
|
||||
|
||||
class TestSignalTabGUI(unittest.TestCase):
|
||||
@@ -16,7 +16,7 @@ class TestSignalTabGUI(unittest.TestCase):
|
||||
# Add a bunch of signals
|
||||
NUM_SIGNALS = 10
|
||||
for _ in range(NUM_SIGNALS):
|
||||
self.form.add_signalfile("./data/esaver.complex")
|
||||
self.form.add_signalfile(get_path_for_data_file("esaver.complex"))
|
||||
|
||||
self.assertEqual(self.form.signal_tab_controller.num_signals, NUM_SIGNALS)
|
||||
|
||||
@@ -24,5 +24,5 @@ class TestSignalTabGUI(unittest.TestCase):
|
||||
QTest.qWait(1)
|
||||
self.assertEqual(self.form.signal_tab_controller.num_signals, 0)
|
||||
|
||||
self.form.add_signalfile("./data/ask.complex")
|
||||
self.form.add_signalfile(get_path_for_data_file("ask.complex"))
|
||||
self.assertEqual(self.form.signal_tab_controller.num_signals, 1)
|
||||
|
||||
12
tests/utils_testing.py
Normal file
12
tests/utils_testing.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import os
|
||||
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
import sys
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
f = os.readlink(__file__) if os.path.islink(__file__) else __file__
|
||||
path = os.path.realpath(os.path.join(f, ".."))
|
||||
|
||||
|
||||
def get_path_for_data_file(filename):
|
||||
return os.path.join(path, "data", filename)
|
||||
Reference in New Issue
Block a user