File: fixture_utils.py

package info (click to toggle)
mycli 1.42.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,036 kB
  • sloc: python: 8,587; makefile: 10
file content (30 lines) | stat: -rw-r--r-- 717 bytes parent folder | download
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
# type: ignore

import os


def read_fixture_lines(filename):
    """Read lines of text from file.

    :param filename: string name
    :return: list of strings

    """
    lines = []
    for line in open(filename):
        lines.append(line.strip())
    return lines


def read_fixture_files():
    """Read all files inside fixture_data directory."""
    fixture_dict = {}

    current_dir = os.path.dirname(__file__)
    fixture_dir = os.path.join(current_dir, "fixture_data/")
    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