# Path: kano_settings/paths.py
# RAW_EDID_DIR = join(EDID_DIR, 'raw')
# 
# RAW_EDID_PATH_PATTERN = join(RAW_EDID_DIR, RAW_EDID_NAME_PATTERN)
# 
# RPI_EDID_DUMPS_PATH_PATTERN = join(RPI_EDID_DUMPS_DIR, '{filename}.dumps.json')
# 
# EDID_EXPECTED_PATH_PATTERN = join(EDID_EXPECTED_DIR, '{filename}.expected.json')


import json
import pytest
from os import listdir
from os.path import basename
from kano_settings.paths import RAW_EDID_DIR, RAW_EDID_PATH_PATTERN, \
    RPI_EDID_DUMPS_PATH_PATTERN, EDID_EXPECTED_PATH_PATTERN
#
# Copyright (C) 2017 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# Fixtures to provide a dataset of EDIDs.





SCREEN_MODELS_WITH_MD5 = [
    raw_edid[:-len(basename(RAW_EDID_PATH_PATTERN.format(filename='')))]
    for raw_edid in listdir(RAW_EDID_DIR)
]


@pytest.fixture(scope='session')
def edid_loader(request):
    """
    A session fixture helper which loads a dataset of EDID data (from res/edid).
    The dataset was generated with tools/edid/generate-rpi-edid-dumps script.

    The return value is a dict containing 'raw', 'rpi_dumps', 'expected' data
    for each display in the dataset.
    """
    edid = dict()

    for model in SCREEN_MODELS_WITH_MD5:
        edid[model] = dict()


# Path: kano_settings/paths.py
# RAW_EDID_DIR = join(EDID_DIR, 'raw')
# 
# RAW_EDID_PATH_PATTERN = join(RAW_EDID_DIR, RAW_EDID_NAME_PATTERN)
# 
# RPI_EDID_DUMPS_PATH_PATTERN = join(RPI_EDID_DUMPS_DIR, '{filename}.dumps.json')
# 
# EDID_EXPECTED_PATH_PATTERN = join(EDID_EXPECTED_DIR, '{filename}.expected.json')


# Path: tests/fixtures/edid_data.py
import json
import pytest
from os import listdir
from os.path import basename
from kano_settings.paths import RAW_EDID_DIR, RAW_EDID_PATH_PATTERN, \
    RPI_EDID_DUMPS_PATH_PATTERN, EDID_EXPECTED_PATH_PATTERN

#
# Copyright (C) 2017 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2
#
# Fixtures to provide a dataset of EDIDs.





SCREEN_MODELS_WITH_MD5 = [
    raw_edid[:-len(basename(RAW_EDID_PATH_PATTERN.format(filename='')))]
    for raw_edid in listdir(RAW_EDID_DIR)
]


@pytest.fixture(scope='session')
def edid_loader(request):
    """
    A session fixture helper which loads a dataset of EDID data (from res/edid).
    The dataset was generated with tools/edid/generate-rpi-edid-dumps script.

    The return value is a dict containing 'raw', 'rpi_dumps', 'expected' data
    for each display in the dataset.
    """
    edid = dict()

    for model in SCREEN_MODELS_WITH_MD5:
        edid[model] = dict()


        raw_edid_path = RAW_EDID_PATH_PATTERN.format(filename=model)