Skip to content
Browse files

move elm327 test fixtures to json

  • Loading branch information...
1 parent d2a958b commit 0b871ee41abb75d3a7de2f6167c2e65a7a47fbee @djs committed Jun 16, 2012
Showing with 19 additions and 13 deletions.
  1. +10 −0 fixtures/elm.json
  2. +9 −13 test_elm.py
View
10 fixtures/elm.json
@@ -0,0 +1,10 @@
+{
+ "": "",
+ "AT@1": "SCANTOOL.NET LLC",
+ "AT@2": "100010006357",
+ "ATDP": "AUTO",
+ "ATRV": "12.3V",
+ "ATSP0": "OK",
+ "ATWS": "\r\rELM327 v1.3a",
+ "ATZ": "\r\rELM327 v1.3a"
+}
View
22 test_elm.py
@@ -1,27 +1,23 @@
-import unittest
-from flexmock import flexmock
-import re
import elm
+import json
+import os
+import re
+
+import unittest
import pytest
class MockElm327(object):
COMMAND_RECEIVED = re.compile('^(.*?)\r', re.M)
- command_table = { 'ATZ' : '\r\rELM327 v1.3a',
- 'ATWS' : '\r\rELM327 v1.3a',
- 'ATRV' : '12.3V',
- 'ATDP' : 'AUTO',
- 'ATSP0': 'OK',
- 'AT@1' : 'SCANTOOL.NET LLC',
- 'AT@2' : '100010006357',
- '' : ''
- }
-
def __init__(self):
self.in_data = ""
self.out_data = ""
self.echo = True
+ fh = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'fixtures', 'elm.json'), 'r')
+ self.command_table = json.load(fh)
+ fh.close()
+
def write(self, data):
self.in_data = self.in_data + data

0 comments on commit 0b871ee

Please sign in to comment.
Something went wrong with that request. Please try again.