[epub, mobi] Paragraph indentation improvements plus support for initials in chapters
[librarian.git] / tests / utils.py
1 # -*- coding: utf-8 -*-
2 #
3 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
4 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 #
6 from __future__ import with_statement
7 from os.path import realpath, join, dirname
8 import glob
9 import os
10
11 def get_fixture_dir(dir_name):
12     """Returns path to fixtures directory dir_name."""
13     return realpath(join(dirname(__file__), 'files', dir_name))
14
15
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)
19
20
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))]