Bike-X  0.8
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
testmsp.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 
3 """
4  Simple Unit Test to MSP class
5 """
6 
7 import unittest
8 import sys
9 sys.path.append('../')
10 from msp430 import MSP, available_ports
11 from glob import glob
12 
13 
14 class TestMSP(unittest.TestCase):
15  """docstring for TestMSP"""
16 
17  def shortDescription(self):
18  return "Test Microcontroler class"
19 
20  def setUp(self):
21  """ Sting up """
22  func = str(self.id).split('=')[-1][:-2]
23  func = func.split('test_')[-1]
24  func = func.replace('_', ' ')
25  out = '\rTest of ' + func + ' '
26  out = out.ljust(65, '-')
27  sys.stderr.write(out)
28  self.shortDescription()
29 
30  port = available_ports()
31  if port:
32  port = port[0]
33  self.msp430 = MSP(port)
34 
35  def tearDown(self):
36  """ Releasing test """
37  sys.stderr.write('Done\n')
38 
39  def test_message(self):
40  """ A test """
41  self.assertIsNotNone(self.msp430.adc.read())
42 
43 if __name__ == "__main__":
44  unittest.main()
def available_ports
Definition: util.py:32