From bb94ad6cf1254f4e65ab2c85d7b0cfbbda3b2d9f Mon Sep 17 00:00:00 2001 From: Johannes Pohl Date: Tue, 31 Jan 2017 15:12:08 +0100 Subject: [PATCH] absolute paths in testing, to start tests from any directory --- tests/startApp.py | 4 ---- tests/test_PCAP.py | 4 ++-- tests/test_RSSI.py | 8 ++------ tests/test_analysis_tab_GUI.py | 10 ++++++---- tests/test_auto_assignments.py | 6 +++--- tests/test_autodetections.py | 12 ++++++------ tests/test_awre.py | 11 ++++------- tests/test_demodulations.py | 7 ++++--- tests/test_fuzzing.py | 8 ++++---- tests/test_generator.py | 10 +++++----- tests/test_generator_table.py | 4 ++-- tests/test_labels.py | 9 ++++----- tests/test_plugins.py | 13 +++++-------- tests/test_project_manager.py | 12 ++++++------ tests/test_protocol_analyzer.py | 8 ++++---- tests/test_protocol_table.py | 4 ++-- tests/test_signal.py | 3 ++- tests/test_signal_tab_GUI.py | 10 +++++----- tests/utils_testing.py | 12 ++++++++++++ 19 files changed, 78 insertions(+), 77 deletions(-) delete mode 100644 tests/startApp.py create mode 100644 tests/utils_testing.py diff --git a/tests/startApp.py b/tests/startApp.py deleted file mode 100644 index 66bf8f34..00000000 --- a/tests/startApp.py +++ /dev/null @@ -1,4 +0,0 @@ -from PyQt5.QtWidgets import QApplication -import sys - -app = QApplication(sys.argv) diff --git a/tests/test_PCAP.py b/tests/test_PCAP.py index 49e4e839..db909bd7 100644 --- a/tests/test_PCAP.py +++ b/tests/test_PCAP.py @@ -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 diff --git a/tests/test_RSSI.py b/tests/test_RSSI.py index 2d2bf8cb..ce2c4c86 100644 --- a/tests/test_RSSI.py +++ b/tests/test_RSSI.py @@ -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 diff --git a/tests/test_analysis_tab_GUI.py b/tests/test_analysis_tab_GUI.py index d939209d..22b3e2d1 100644 --- a/tests/test_analysis_tab_GUI.py +++ b/tests/test_analysis_tab_GUI.py @@ -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) diff --git a/tests/test_auto_assignments.py b/tests/test_auto_assignments.py index 41f2c8f1..180c573a 100644 --- a/tests/test_auto_assignments.py +++ b/tests/test_auto_assignments.py @@ -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", ""), {})) diff --git a/tests/test_autodetections.py b/tests/test_autodetections.py index 9d9e46cc..4b56bbf3 100644 --- a/tests/test_autodetections.py +++ b/tests/test_autodetections.py @@ -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 diff --git a/tests/test_awre.py b/tests/test_awre.py index 92f2d448..b275729a 100644 --- a/tests/test_awre.py +++ b/tests/test_awre.py @@ -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 diff --git a/tests/test_demodulations.py b/tests/test_demodulations.py index d13fc1bf..bdaf6b93 100644 --- a/tests/test_demodulations.py +++ b/tests/test_demodulations.py @@ -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 diff --git a/tests/test_fuzzing.py b/tests/test_fuzzing.py index 24f45de2..ea66c09f 100644 --- a/tests/test_fuzzing.py +++ b/tests/test_fuzzing.py @@ -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) diff --git a/tests/test_generator.py b/tests/test_generator.py index 62b4b854..99ded49c 100644 --- a/tests/test_generator.py +++ b/tests/test_generator.py @@ -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) diff --git a/tests/test_generator_table.py b/tests/test_generator_table.py index 66d478d9..ac83eaea 100644 --- a/tests/test_generator_table.py +++ b/tests/test_generator_table.py @@ -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): diff --git a/tests/test_labels.py b/tests/test_labels.py index 92769092..45d1c736 100644 --- a/tests/test_labels.py +++ b/tests/test_labels.py @@ -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) diff --git a/tests/test_plugins.py b/tests/test_plugins.py index d3753f9b..df98d92b 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -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) diff --git a/tests/test_project_manager.py b/tests/test_project_manager.py index ed9c22a3..603992b4 100644 --- a/tests/test_project_manager.py +++ b/tests/test_project_manager.py @@ -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) diff --git a/tests/test_protocol_analyzer.py b/tests/test_protocol_analyzer.py index 4e430577..e33202bf 100644 --- a/tests/test_protocol_analyzer.py +++ b/tests/test_protocol_analyzer.py @@ -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 diff --git a/tests/test_protocol_table.py b/tests/test_protocol_table.py index 15dd552b..2b4eb468 100644 --- a/tests/test_protocol_table.py +++ b/tests/test_protocol_table.py @@ -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): diff --git a/tests/test_signal.py b/tests/test_signal.py index 808d7582..0d186bf4 100644 --- a/tests/test_signal.py +++ b/tests/test_signal.py @@ -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 diff --git a/tests/test_signal_tab_GUI.py b/tests/test_signal_tab_GUI.py index b2ac47c8..c88bb82d 100644 --- a/tests/test_signal_tab_GUI.py +++ b/tests/test_signal_tab_GUI.py @@ -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) diff --git a/tests/utils_testing.py b/tests/utils_testing.py new file mode 100644 index 00000000..62ba9b7d --- /dev/null +++ b/tests/utils_testing.py @@ -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) \ No newline at end of file