From 1c2b85daf9e99fa556cdcad67e98344d775bf9aa Mon Sep 17 00:00:00 2001 From: Ian Joseph Wilson Date: Sat, 15 Jun 2013 14:20:33 -0700 Subject: [PATCH] Refactor test class to re-use. --- tests/test_arduino.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/test_arduino.py b/tests/test_arduino.py index 6060af4..8787de6 100644 --- a/tests/test_arduino.py +++ b/tests/test_arduino.py @@ -54,7 +54,15 @@ MSBFIRST = "MSBFIRST" LSBFIRST = "LSBFIRST" -class TestArduino(unittest.TestCase): +class ArduinoTestCase(unittest.TestCase): + + def setUp(self): + from Arduino.arduino import Arduino + self.mock_serial = MockSerial(9600, '/dev/ttyACM0') + self.board = Arduino(sr=self.mock_serial) + + +class TestArduino(ArduinoTestCase): def parse_cmd_sr(self, cmd_str): assert cmd_str[0] == '@' @@ -68,11 +76,6 @@ class TestArduino(unittest.TestCase): args = args_str.split('%') return cmd, args - def setUp(self): - from Arduino.arduino import Arduino - self.mock_serial = MockSerial(9600, '/dev/ttyACM0') - self.board = Arduino(sr=self.mock_serial) - def test_close(self): self.board.close() # Call again, should skip calling close.