From 86f9cd83a067bc55506c4e3e3b436c87dc96ef68 Mon Sep 17 00:00:00 2001 From: Maximilien Rigaut Date: Fri, 5 Nov 2021 21:46:37 +0100 Subject: [PATCH] test & init.py --- .idea/.gitignore | 3 + src/__init__.py | 1 + src/midiRebind/__init__.py | 2 +- src/midiRebind/mapping/__init__.py | 2 +- test.py | 262 --------------------------- tests/basetst_midiRebind.py | 281 +++++++++++++++++++++++++++++ tests/test_bindings.py | 4 + tests/test_midiRebind.py | 278 ---------------------------- tests/test_panaremote.py | 2 +- 9 files changed, 292 insertions(+), 543 deletions(-) create mode 100644 .idea/.gitignore delete mode 100644 test.py create mode 100644 tests/basetst_midiRebind.py create mode 100644 tests/test_bindings.py delete mode 100644 tests/test_midiRebind.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/src/__init__.py b/src/__init__.py index e69de29..bbeeff6 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -0,0 +1 @@ +__all__ = ['midiRebind'] diff --git a/src/midiRebind/__init__.py b/src/midiRebind/__init__.py index 880f9d0..5dfaeeb 100644 --- a/src/midiRebind/__init__.py +++ b/src/midiRebind/__init__.py @@ -1 +1 @@ -__all__=["mapping","panaremote","pythonAnalogWay"] \ No newline at end of file +__all__ = ["mapping", "panaremote", "pythonAnalogWay"] \ No newline at end of file diff --git a/src/midiRebind/mapping/__init__.py b/src/midiRebind/mapping/__init__.py index 3df6f08..0beb50d 100644 --- a/src/midiRebind/mapping/__init__.py +++ b/src/midiRebind/mapping/__init__.py @@ -1 +1 @@ -__all__ = ["mapping","GrandMA2","midipagehandler"] #Never import * as every parse is supposed to be named MessageParse +__all__ = ["GrandMA2", "midiPageHandler"] # Never import * as every parse is supposed to be named MessageParse diff --git a/test.py b/test.py deleted file mode 100644 index e3bea38..0000000 --- a/test.py +++ /dev/null @@ -1,262 +0,0 @@ -from minitest import minitest -import configparser,mido -#from mapping import GrandMA2 - -class gmaPyTest(minitest.simpleTestUnit): - """Testing the General interface""" - def __init__(self): - super(gmaPyTest, self).__init__("gmaPy") - - def _testCustom(self): - self.currentTest("testing true") - if True: - self.addSuccess() - else: - self.addFailure("True is False") - -class mappingTest(minitest.simpleTestUnit): - """Testing the parsing/mapping""" - def __init__(self): - super(mappingTest, self).__init__("parsing/mapping") - self.verbose=True - def _testParsing(self): - self.currentTest("Loading default mappings") - from src.midiRebind.mapping import GrandMA2 - self.gm= GrandMA2 - self.addSuccess() - - self.currentTest("Creating Parser") - self.parser= GrandMA2.MessageParse() - self.addSuccess() - - self.currentTest("Testing hex2dec") - testX=["22","19 22","3 4 5 6 22 FF"] - testD=[[34],[25,34],[3, 4, 5, 6, 34, 255]] - sucess=1 - for X,D in zip(testX,testD): - #print("{} / {} : {} [{}]".format(X,D,self.toDec(X),D==self.toDec(X))) - if toDec(X)!=D: - self.addFailure("Can't convert Hex to Dec") - sucess=0 - break - if sucess: - self.addSuccess() - - #I'm ifnoring the None case on purpose because I can't be bothered with, if it fails, it might as well fail big - self.currentTest("Test with ill-formed message") - if self.testParse([22, 12]): - self.addFailure("The message is not supposed to be parsed") - else: - self.addSuccess() - - self.currentTest("Test with well-formed message") - msg=toDec("7F 7F 02 7F 01 32 31 2E 35 30 30") - if self.testParse(msg): - self.addSuccess() - else: - self.addFailure("Can't parse the message {}".format(msg)) - - self.currentTest("Checking sanity of parse") - di=self.parser(mido.Message("sysex",data=msg)) - inc="" - if di.command!=1: - inc="command {} ".format(di.command) - if list(di.data)!=[50, 49, 46, 53, 48, 48]: - inc+="data {} ".format(di.data) - if di.deviceid!=127: - inc+="deviceid {} ".format(di.deviceid) - if di.commandformat!=127: - inc+="commandformat {}".format(di.commandformat) - if inc=="": - self.addSuccess() - else: - self.addFailure("Incorrect fields: "+inc[:-1]) - - self.currentTest("Loading Config") - try: - def testfunction(*params): - print("| > testfunction used in test",params) - return 1 - - class Emptyconfig(): - def __init__(self,configfile): - self.config=configparser.ConfigParser() - self.config.read(configfile) - self.functionlist={"testfunction":testfunction} - - def interfaceOut(self,nb): - class EmptySender(): - def __init__(self): - self.name="none:none" - pass - def send(self,wev,**kwargs): - pass - return EmptySender() - self.e_config=Emptyconfig("patch/test.ini") - self.act= GrandMA2.Actions(self.e_config) - self.addSuccess() - except IOError: - self.addFailure("Can't load config file") - - #self.act.prettyprint() - self.currentTest("Testing the request formatter") - try: - setsect=self.act.findAction("set","1","1") - try: - self.act.findAction("set","2","3") - self.addFailure("Not supposed to load page 3") - except: - try: - self.act.findAction("fire","13","2") - self.addSuccess() - except: - self.addFailure("Can't acess the fire section") - except: - self.addFailure("Can't get (note 1 on page 1)") - - self.currentTest("Testing the loaded config") - try: - if len(self.act.findAction("set",1,'5'))==2: - self.addSuccess() - else: - self.addFailure("Action 1 section 5 (set/5) is supposed to contain 2 elements") - except: - self.addFailure("Can't find action 1 (set/5)") - # A couple more test would be wise, but nearing completion seems more important atm - - self.currentTest("Testing a message") - try: - self.act.findAction("set",1,"5") - self.addSuccess() - except: - self.addFailure("Failed to load action") - - self.currentTest("Testing the valuefn") - try: - acts=self.act.findAction("set",56,"1") - for act in acts: - if act.valuefn(51)==100: - self.addSuccess() - except: - self.addFailure("Function for key {} isn't working".format(56)) - - self.currentTest("Testing the toggle") - try: - st=True - acts=self.act.findAction("fire",38,"1") - for act in acts: - if not act.toggle: - self.addFailure("Trigger isn't assigned") - st=False - break - except: - self.addFailure("Toggle for key 38 isn't assigned") - st=False - if st: - self.addSuccess() - - self.currentTest("Testing custom function") - try: - st=True - acts=self.act.findAction("custom",77,"2") - # print(acts) - for act in acts: - #print(act,act.funct) - if not act.funct or not act.execspecialfn(55): - st=False - self.addFailure("No custom function defined") - break - except KeyError: - self.addFailure("Can't use custom function") - st=False - if st: - self.addSuccess() - - self.currentTest("Testing call") - acts=self.act.findAction("fire",38,"1") - for act in acts: - act(12) - st=act.toggle - act(12) - st1=act.toggle - if st==st1: - self.addFailure("State not changing after a call") - #self.act.prettyprint() - - def testParse(self,message): - try: - message=mido.Message("sysex",data=message) - parsed=self.parser(message) - return True - except self.gm.MatchError: - return False - except: - import sys - print(sys.exc_info()) - self.addCritical("Can't parse (not supposed to happen)") - -def toDec(message): - "Taken care of by mido, but testing needs to be done otherwise" - res=[] - for hx in message.split(" "): - if res==[]: - res=[int(hx,16)] - else: - res+=[int(hx,16)] - return res - -class ConfigTest(minitest.simpleTestUnit): - def __init__(self): - super(ConfigTest, self).__init__("Testing the config loader") - - def _testAll(self): - self.currentTest("Loading config") - from src.midiRebind.mapping import GrandMA2 - GrandMA2.MidiInterface("patch/test.ini") - self.addSuccess() - -class LiveTest(minitest.simpleTestUnit): - def __init__(self): - super(LiveTest, self).__init__("Live test") - - def _testAll(self): - self.currentTest("Loading config") - from src.midiRebind.mapping import GrandMA2 - Inter= GrandMA2.MidiInterface("patch/test.ini") - self.addSuccess() - - self.currentTest("Loading message parser") - Par= GrandMA2.MessageParse() - self.addSuccess() - - self.currentTest("Loading Patch") - - # print(GrandMA2.Actions) - - Acts= GrandMA2.Actions(Inter) - self.addSuccess() - #Act.prettyprint() - - self.currentTest("Trying match") - - message=toDec("7F 7F 02 7F 01 33 37 2E 32 30 30 00 35 20 31") - message=toDec("7F 7F 02 7F 06 02 02 4C 39") - try: - match=Par(mido.Message("sysex",data=message)) - self.addSuccess() - except GrandMA2.MatchError: - self.addFailure("Can't match '{}'".format(mido.Message(message))) - except: - self.addFailure("Error while matching") - - self.currentTest("Sending message") - match=Acts(match) - self.addSuccess() - -if __name__ == '__main__': - allTests=minitest.testGroup("Nominal test units",verbose=True,align=50) - - allTests.addTest(mappingTest()) - allTests.addTest(ConfigTest()) - allTests.addTest(LiveTest()) - allTests.test() diff --git a/tests/basetst_midiRebind.py b/tests/basetst_midiRebind.py new file mode 100644 index 0000000..0487a8c --- /dev/null +++ b/tests/basetst_midiRebind.py @@ -0,0 +1,281 @@ +import configparser + +import mido + +import midiRebind +# from midiRebind.minitest import minitest +# +# +# # from mapping import GrandMA2 +# +# class GmaPyTest(minitest.simpleTestUnit): +# """Testing the General interface""" +# +# def __init__(self): +# super(GmaPyTest, self).__init__("gmaPy") +# +# def _test_custom(self): +# self.currentTest("testing true") +# if True: +# self.addSuccess() +# +# +# class MappingTest(minitest.simpleTestUnit): +# """Testing the parsing/mapping""" +# +# def __init__(self): +# super(MappingTest, self).__init__("parsing/mapping") +# self.verbose = True +# +# def _test_parsing(self): +# self.currentTest("Loading default mappings") +# from src.midiRebind.mapping import GrandMA2 +# self.gm = GrandMA2 +# self.addSuccess() +# +# self.currentTest("Creating Parser") +# self.parser = GrandMA2.MessageParse() +# self.addSuccess() +# +# self.currentTest("Testing hex2dec") +# testX = ["22", "19 22", "3 4 5 6 22 FF"] +# testD = [[34], [25, 34], [3, 4, 5, 6, 34, 255]] +# success = 1 +# for X, D in zip(testX, testD): +# # print("{} / {} : {} [{}]".format(X,D,self.toDec(X),D==self.toDec(X))) +# if toDec(X) != D: +# self.addFailure("Can't convert Hex to Dec") +# success = 0 +# break +# if success: +# self.addSuccess() +# +# # I'm ignoring the None case on purpose because I can't be bothered with, if it fails, it might as well fail big +# self.currentTest("Test with ill-formed message") +# if self.testParse([22, 12]): +# self.addFailure("The message is not supposed to be parsed") +# else: +# self.addSuccess() +# +# self.currentTest("Test with well-formed message") +# msg = toDec("7F 7F 02 7F 01 32 31 2E 35 30 30") +# if self.testParse(msg): +# self.addSuccess() +# else: +# self.addFailure("Can't parse the message {}".format(msg)) +# +# self.currentTest("Checking sanity of parse") +# di = self.parser(mido.Message("sysex", data=msg)) +# inc = "" +# if di.command != 1: +# inc = "command {} ".format(di.command) +# if list(di.data) != [50, 49, 46, 53, 48, 48]: +# inc += "data {} ".format(di.data) +# if di.deviceid != 127: +# inc += "deviceid {} ".format(di.deviceid) +# if di.commandformat != 127: +# inc += "commandformat {}".format(di.commandformat) +# if inc == "": +# self.addSuccess() +# else: +# self.addFailure("Incorrect fields: " + inc[:-1]) +# +# self.currentTest("Loading Config") +# try: +# def testfunction(*params): +# print("| > testfunction used in test", params) +# return 1 +# +# class Emptyconfig: +# def __init__(self, configfile): +# self.config = configparser.ConfigParser() +# self.config.read(configfile) +# self.functionlist = {"testfunction": testfunction} +# +# def interface_out(self, nb): +# class EmptySender(): +# def __init__(self): +# self.name = "none:none" +# pass +# +# def send(self, wev, **kwargs): +# pass +# +# return EmptySender() +# +# self.e_config = Emptyconfig("patch/test.ini") +# self.act = GrandMA2.Actions(self.e_config) +# self.addSuccess() +# except IOError: +# self.addFailure("Can't load config file") +# +# # self.act.prettyprint() +# self.currentTest("Testing the request formatter") +# try: +# self.act.findAction("set", "1", "1") +# try: +# self.act.findAction("set", "2", "3") +# self.addFailure("Not supposed to load page 3") +# except: +# try: +# self.act.findAction("fire", "13", "2") +# self.addSuccess() +# except: +# self.addFailure("Can't access the fire section") +# except: +# self.addFailure("Can't get (note 1 on page 1)") +# +# self.currentTest("Testing the loaded config") +# try: +# if len(self.act.findAction("set", 1, '5')) == 2: +# self.addSuccess() +# else: +# self.addFailure("Action 1 section 5 (set/5) is supposed to contain 2 elements") +# except: +# self.addFailure("Can't find action 1 (set/5)") +# # A couple more test would be wise, but nearing completion seems more important atm +# +# self.currentTest("Testing a message") +# try: +# self.act.findAction("set", 1, "5") +# self.addSuccess() +# except: +# self.addFailure("Failed to load action") +# +# self.currentTest("Testing the valuefn") +# try: +# acts = self.act.findAction("set", 56, "1") +# for act in acts: +# if act.valuefn(51) == 100: +# self.addSuccess() +# except: +# self.addFailure("Function for key {} isn't working".format(56)) +# +# self.currentTest("Testing the toggle") +# try: +# st = True +# acts = self.act.findAction("fire", 38, "1") +# for act in acts: +# if not act.toggle: +# self.addFailure("Trigger isn't assigned") +# st = False +# break +# except: +# self.addFailure("Toggle for key 38 isn't assigned") +# st = False +# if st: +# self.addSuccess() +# +# self.currentTest("Testing custom function") +# try: +# st = True +# acts = self.act.findAction("custom", 77, "2") +# # print(acts) +# for act in acts: +# # print(act,act.funct) +# if not act.funct or not act.execspecialfn(55): +# st = False +# self.addFailure("No custom function defined") +# break +# except KeyError: +# self.addFailure("Can't use custom function") +# st = False +# if st: +# self.addSuccess() +# +# self.currentTest("Testing call") +# acts = self.act.findAction("fire", 38, "1") +# for act in acts: +# act(12) +# st = act.toggle +# act(12) +# st1 = act.toggle +# if st == st1: +# self.addFailure("State not changing after a call") +# # self.act.prettyprint() +# +# def testParse(self, message): +# try: +# message = mido.Message("sysex", data=message) +# parsed = self.parser(message) +# return True +# except self.gm.MatchError: +# return False +# except: +# import sys +# print(sys.exc_info()) +# self.addCritical("Can't parse (not supposed to happen)") +# +# +# def toDec(message): +# """Taken care of by mido, but testing needs to be done otherwise""" +# res = [] +# for hx in message.split(" "): +# if res == []: +# res = [int(hx, 16)] +# else: +# res += [int(hx, 16)] +# return res +# +# +# class ConfigTest(minitest.simpleTestUnit): +# def __init__(self): +# super(ConfigTest, self).__init__("Testing the config loader") +# +# def _testAll(self): +# self.currentTest("Loading config") +# from src.midiRebind.mapping import GrandMA2 +# GrandMA2.MidiInterface("patch/test.ini") +# self.addSuccess() +# +# +# class LiveTest(minitest.simpleTestUnit): +# def __init__(self): +# super(LiveTest, self).__init__("Live test") +# +# def _testAll(self): +# self.currentTest("Loading config") +# from src.midiRebind.mapping import GrandMA2 +# Inter = GrandMA2.MidiInterface("patch/test.ini") +# self.addSuccess() +# +# self.currentTest("Loading message parser") +# Par = GrandMA2.MessageParse() +# self.addSuccess() +# +# self.currentTest("Loading Patch") +# +# # print(GrandMA2.Actions) +# +# Acts = GrandMA2.Actions(Inter) +# self.addSuccess() +# # Act.prettyprint() +# +# self.currentTest("Trying match") +# +# message = toDec("7F 7F 02 7F 01 33 37 2E 32 30 30 00 35 20 31") +# message = toDec("7F 7F 02 7F 06 02 02 4C 39") +# match = None +# try: +# match = Par(mido.Message("sysex", data=message)) +# self.addSuccess() +# except GrandMA2.MatchError: +# self.addFailure("Can't match '{}'".format(mido.Message(message))) +# except: +# self.addFailure("Error while matching") +# +# self.currentTest("Sending message") +# match = Acts(match) +# self.addSuccess() + + +if __name__ == '__main__': + "Loading default mappings" + + + # allTests = minitest.testGroup("Nominal test units", verbose=True, align=50) + # + # allTests.addTest(MappingTest()) + # allTests.addTest(ConfigTest()) + # allTests.addTest(LiveTest()) + # allTests.test() diff --git a/tests/test_bindings.py b/tests/test_bindings.py new file mode 100644 index 0000000..5f3e898 --- /dev/null +++ b/tests/test_bindings.py @@ -0,0 +1,4 @@ +from midiRebind.mapping import GrandMA2 + + +parser = GrandMA2.MessageParse() \ No newline at end of file diff --git a/tests/test_midiRebind.py b/tests/test_midiRebind.py deleted file mode 100644 index 3bcfcf8..0000000 --- a/tests/test_midiRebind.py +++ /dev/null @@ -1,278 +0,0 @@ -import configparser - -import mido - -from src.midiRebind.minitest import minitest - - -# from mapping import GrandMA2 - -class GmaPyTest(minitest.simpleTestUnit): - """Testing the General interface""" - - def __init__(self): - super(GmaPyTest, self).__init__("gmaPy") - - def _test_custom(self): - self.currentTest("testing true") - if True: - self.addSuccess() - - -class MappingTest(minitest.simpleTestUnit): - """Testing the parsing/mapping""" - - def __init__(self): - super(MappingTest, self).__init__("parsing/mapping") - self.verbose = True - - def _test_parsing(self): - self.currentTest("Loading default mappings") - from src.midiRebind.mapping import GrandMA2 - self.gm = GrandMA2 - self.addSuccess() - - self.currentTest("Creating Parser") - self.parser = GrandMA2.MessageParse() - self.addSuccess() - - self.currentTest("Testing hex2dec") - testX = ["22", "19 22", "3 4 5 6 22 FF"] - testD = [[34], [25, 34], [3, 4, 5, 6, 34, 255]] - success = 1 - for X, D in zip(testX, testD): - # print("{} / {} : {} [{}]".format(X,D,self.toDec(X),D==self.toDec(X))) - if toDec(X) != D: - self.addFailure("Can't convert Hex to Dec") - success = 0 - break - if success: - self.addSuccess() - - # I'm ignoring the None case on purpose because I can't be bothered with, if it fails, it might as well fail big - self.currentTest("Test with ill-formed message") - if self.testParse([22, 12]): - self.addFailure("The message is not supposed to be parsed") - else: - self.addSuccess() - - self.currentTest("Test with well-formed message") - msg = toDec("7F 7F 02 7F 01 32 31 2E 35 30 30") - if self.testParse(msg): - self.addSuccess() - else: - self.addFailure("Can't parse the message {}".format(msg)) - - self.currentTest("Checking sanity of parse") - di = self.parser(mido.Message("sysex", data=msg)) - inc = "" - if di.command != 1: - inc = "command {} ".format(di.command) - if list(di.data) != [50, 49, 46, 53, 48, 48]: - inc += "data {} ".format(di.data) - if di.deviceid != 127: - inc += "deviceid {} ".format(di.deviceid) - if di.commandformat != 127: - inc += "commandformat {}".format(di.commandformat) - if inc == "": - self.addSuccess() - else: - self.addFailure("Incorrect fields: " + inc[:-1]) - - self.currentTest("Loading Config") - try: - def testfunction(*params): - print("| > testfunction used in test", params) - return 1 - - class Emptyconfig: - def __init__(self, configfile): - self.config = configparser.ConfigParser() - self.config.read(configfile) - self.functionlist = {"testfunction": testfunction} - - def interface_out(self, nb): - class EmptySender(): - def __init__(self): - self.name = "none:none" - pass - - def send(self, wev, **kwargs): - pass - - return EmptySender() - - self.e_config = Emptyconfig("patch/test.ini") - self.act = GrandMA2.Actions(self.e_config) - self.addSuccess() - except IOError: - self.addFailure("Can't load config file") - - # self.act.prettyprint() - self.currentTest("Testing the request formatter") - try: - self.act.findAction("set", "1", "1") - try: - self.act.findAction("set", "2", "3") - self.addFailure("Not supposed to load page 3") - except: - try: - self.act.findAction("fire", "13", "2") - self.addSuccess() - except: - self.addFailure("Can't access the fire section") - except: - self.addFailure("Can't get (note 1 on page 1)") - - self.currentTest("Testing the loaded config") - try: - if len(self.act.findAction("set", 1, '5')) == 2: - self.addSuccess() - else: - self.addFailure("Action 1 section 5 (set/5) is supposed to contain 2 elements") - except: - self.addFailure("Can't find action 1 (set/5)") - # A couple more test would be wise, but nearing completion seems more important atm - - self.currentTest("Testing a message") - try: - self.act.findAction("set", 1, "5") - self.addSuccess() - except: - self.addFailure("Failed to load action") - - self.currentTest("Testing the valuefn") - try: - acts = self.act.findAction("set", 56, "1") - for act in acts: - if act.valuefn(51) == 100: - self.addSuccess() - except: - self.addFailure("Function for key {} isn't working".format(56)) - - self.currentTest("Testing the toggle") - try: - st = True - acts = self.act.findAction("fire", 38, "1") - for act in acts: - if not act.toggle: - self.addFailure("Trigger isn't assigned") - st = False - break - except: - self.addFailure("Toggle for key 38 isn't assigned") - st = False - if st: - self.addSuccess() - - self.currentTest("Testing custom function") - try: - st = True - acts = self.act.findAction("custom", 77, "2") - # print(acts) - for act in acts: - # print(act,act.funct) - if not act.funct or not act.execspecialfn(55): - st = False - self.addFailure("No custom function defined") - break - except KeyError: - self.addFailure("Can't use custom function") - st = False - if st: - self.addSuccess() - - self.currentTest("Testing call") - acts = self.act.findAction("fire", 38, "1") - for act in acts: - act(12) - st = act.toggle - act(12) - st1 = act.toggle - if st == st1: - self.addFailure("State not changing after a call") - # self.act.prettyprint() - - def testParse(self, message): - try: - message = mido.Message("sysex", data=message) - parsed = self.parser(message) - return True - except self.gm.MatchError: - return False - except: - import sys - print(sys.exc_info()) - self.addCritical("Can't parse (not supposed to happen)") - - -def toDec(message): - """Taken care of by mido, but testing needs to be done otherwise""" - res = [] - for hx in message.split(" "): - if res == []: - res = [int(hx, 16)] - else: - res += [int(hx, 16)] - return res - - -class ConfigTest(minitest.simpleTestUnit): - def __init__(self): - super(ConfigTest, self).__init__("Testing the config loader") - - def _testAll(self): - self.currentTest("Loading config") - from src.midiRebind.mapping import GrandMA2 - GrandMA2.MidiInterface("patch/test.ini") - self.addSuccess() - - -class LiveTest(minitest.simpleTestUnit): - def __init__(self): - super(LiveTest, self).__init__("Live test") - - def _testAll(self): - self.currentTest("Loading config") - from src.midiRebind.mapping import GrandMA2 - Inter = GrandMA2.MidiInterface("patch/test.ini") - self.addSuccess() - - self.currentTest("Loading message parser") - Par = GrandMA2.MessageParse() - self.addSuccess() - - self.currentTest("Loading Patch") - - # print(GrandMA2.Actions) - - Acts = GrandMA2.Actions(Inter) - self.addSuccess() - # Act.prettyprint() - - self.currentTest("Trying match") - - message = toDec("7F 7F 02 7F 01 33 37 2E 32 30 30 00 35 20 31") - message = toDec("7F 7F 02 7F 06 02 02 4C 39") - match = None - try: - match = Par(mido.Message("sysex", data=message)) - self.addSuccess() - except GrandMA2.MatchError: - self.addFailure("Can't match '{}'".format(mido.Message(message))) - except: - self.addFailure("Error while matching") - - self.currentTest("Sending message") - match = Acts(match) - self.addSuccess() - - -if __name__ == '__main__': - - allTests = minitest.testGroup("Nominal test units", verbose=True, align=50) - - allTests.addTest(MappingTest()) - allTests.addTest(ConfigTest()) - allTests.addTest(LiveTest()) - allTests.test() diff --git a/tests/test_panaremote.py b/tests/test_panaremote.py index cf2bc9b..e26e79d 100644 --- a/tests/test_panaremote.py +++ b/tests/test_panaremote.py @@ -1,4 +1,4 @@ -import midiRebind +pytimport midiRebind from midiRebind import panaremote, pythonAnalogWay