blob: dcc09db4a1172cc371966f26bd27b8c50e0b5218 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
import os
import codecs
def read_fixture_lines(filename):
"""
Read lines of text from file.
:param filename: string name
:return: list of strings
"""
lines = []
for line in codecs.open(filename, 'rb', encoding='utf-8'):
lines.append(line.strip())
return lines
def read_fixture_files(fixture_dir):
"""
Read all files inside fixture_data directory.
"""
fixture_dict = {}
for filename in os.listdir(fixture_dir):
if filename not in ['.', '..']:
fullname = os.path.join(fixture_dir, filename)
fixture_dict[filename] = read_fixture_lines(fullname)
return fixture_dict
|