1 # -*- coding: utf-8 -*-
3 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
4 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
6 from os.path import realpath, join, dirname
10 def get_fixture_dir(dir_name):
11 """Returns path to fixtures directory dir_name."""
12 return realpath(join(dirname(__file__), 'files', dir_name))
15 def get_fixture(dir_name, file_name):
16 """Returns path to fixture file_name in directory dir_name."""
17 return join(get_fixture_dir(dir_name), file_name)
20 def get_all_fixtures(dir_name, glob_pattern='*'):
21 """Returns list of paths for fixtures in directory dir_name matching the glob_pattern."""
22 return [get_fixture(dir_name, file_name) for file_name in glob.glob(join(get_fixture_dir(dir_name), glob_pattern))]