1 # -*- coding: utf-8 -*-
3 # Copyright © 2008,2009,2010 Fundacja Nowoczesna Polska
5 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
6 # For full license text see COPYING or <http://www.gnu.org/licenses/agpl.html>
8 from __future__ import with_statement
9 from os.path import realpath, join, dirname
13 def get_fixture_dir(dir_name):
14 """Returns path to fixtures directory dir_name."""
15 return realpath(join(dirname(__file__), 'files', dir_name))
18 def get_fixture(dir_name, file_name):
19 """Returns path to fixture file_name in directory dir_name."""
20 return join(get_fixture_dir(dir_name), file_name)
23 def get_all_fixtures(dir_name, glob_pattern='*'):
24 """Returns list of paths for fixtures in directory dir_name matching the glob_pattern."""
25 return [get_fixture(dir_name, file_name) for file_name in glob.glob(join(get_fixture_dir(dir_name), glob_pattern))]
28 def remove_output_file(dir_name, file_name):
30 os.remove(get_fixture(dir_name, file_name))