Skip to content

Commit

Permalink
Switched tools/run_tests to use the csv module.
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzeman committed Dec 7, 2013
1 parent cf1f9d8 commit ccc2ba3
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions tools/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from logr import Logrs
import logging
import os
from logr import Logr
import csv
import sys
import os

src_path = os.path.join(os.path.dirname(__file__), '..', 'src')
sys.path.insert(0, os.path.abspath(src_path))
Expand All @@ -30,8 +31,8 @@ def __init__(self, debug):
self.name_col = None
self.test_names = None

def _read_header(self, fp):
header = fp.readline().strip().split(",")
def _read_header(self, reader):
header = next(reader)

for i, col in enumerate(header):
if col == 'name':
Expand All @@ -45,11 +46,15 @@ def load(self, filename, limit = 100):
raise Exception()

with open(filename) as fp:
self._read_header(fp)
reader = csv.reader(fp)

self._read_header(reader)

self.test_names = []
for i, line in enumerate(fp):
row = line.strip().split(',')
for i, row in enumerate(reader):
if not len(row) or row[0].startswith('#'):
continue

self.test_names.append(row[self.name_col])

if len(self.test_names) >= limit:
Expand Down

0 comments on commit ccc2ba3

Please sign in to comment.