import os import json import pytest import _pytest TEST_PROPERTY_DATA_ROOT = "test_data/property_files" @pytest.fixture def canned_data_input(pytestconfig: _pytest.config.Config): # def canned_data_input(): def get_canned_data(filename): full_path = os.path.join( pytestconfig.rootdir, TEST_PROPERTY_DATA_ROOT, filename ) with open(full_path + ".txt", "r") as test_file: return test_file.read() return get_canned_data @pytest.fixture def canned_data_output(pytestconfig: _pytest.config.Config): # def canned_data_output(): def get_canned_data(filename): full_path = os.path.join( pytestconfig.rootdir, TEST_PROPERTY_DATA_ROOT, filename ) with open(full_path + ".json", "r") as test_file: return json.load(test_file) return get_canned_data