diff options
Diffstat (limited to 'midi_launchpad_mini_integrationtest.py')
-rw-r--r-- | midi_launchpad_mini_integrationtest.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/midi_launchpad_mini_integrationtest.py b/midi_launchpad_mini_integrationtest.py index e5b757c..5a28925 100644 --- a/midi_launchpad_mini_integrationtest.py +++ b/midi_launchpad_mini_integrationtest.py @@ -6,11 +6,9 @@ from player_mock import Player as PlayerMock class MidiWrapperMock: def __init__(self): - from queue import SimpleQueue self.callback = None self.connectedDevice = None - self.sentMessages = SimpleQueue() - self.latestMessage = None + self.sentMessages = list() def setCallback(self, callback): self.callback = callback @@ -19,8 +17,7 @@ class MidiWrapperMock: self.connectedDevice = deviceName def sendMessage(self, note, velocity, channel): - self.latestMessage = (note, velocity, channel) - self.sentMessages.put(self.latestMessage) + self.sentMessages.append((note, velocity, channel)) def simulateInput(self, note, velocity=127, channel=0): if self.callback is not None: @@ -29,7 +26,7 @@ class MidiWrapperMock: self.callback(msg) def getLatestMessage(self): - return self.latestMessage + return self.sentMessages[-1] @pytest.fixture def playerMock(): @@ -231,9 +228,6 @@ def test_initializationMessages(uut, midiWrapperMock): uut.connect() - sentMessages = set() - while (not midiWrapperMock.sentMessages.empty()): - sentMessages.add(midiWrapperMock.sentMessages.get()) - - assert sentMessages == expectedMessages + sentMessagesSet = set(midiWrapperMock.sentMessages) + assert sentMessagesSet == expectedMessages |