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 __future__ import with_statement
7 from os.path import realpath, join, dirname
11 def get_fixture_dir(dir_name):
12 """Returns path to fixtures directory dir_name."""
13 return realpath(join(dirname(__file__), 'files', dir_name))
16 def get_fixture(dir_name, file_name):
17 """Returns path to fixture file_name in directory dir_name."""
18 return join(get_fixture_dir(dir_name), file_name)
21 def get_all_fixtures(dir_name, glob_pattern='*'):
22 """Returns list of paths for fixtures in directory dir_name matching the glob_pattern."""
23 return [get_fixture(dir_name, file_name) for file_name in glob.glob(join(get_fixture_dir(dir_name), glob_pattern))]