diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2014-09-19 13:53:56 +0200 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2014-09-22 20:01:24 +0200 |
commit | 7fb4dee193f56b0b3f43c6fc8560bd1569b9bd30 (patch) | |
tree | a4879a894685e85bc4c4078618f59d6c6ce0bf77 /tests/_bootstrap.py | |
parent | 8a89761b99bfd66d16488db2f34d2dcc4883a569 (diff) | |
download | clufter-7fb4dee193f56b0b3f43c6fc8560bd1569b9bd30.tar.gz clufter-7fb4dee193f56b0b3f43c6fc8560bd1569b9bd30.tar.xz clufter-7fb4dee193f56b0b3f43c6fc8560bd1569b9bd30.zip |
Make run-dev central point for local use (e.g., test run)
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'tests/_bootstrap.py')
l---------[-rw-r--r--] | tests/_bootstrap.py | 51 |
1 files changed, 1 insertions, 50 deletions
diff --git a/tests/_bootstrap.py b/tests/_bootstrap.py index 70b95bc..6a45d62 100644..120000 --- a/tests/_bootstrap.py +++ b/tests/_bootstrap.py @@ -1,50 +1 @@ -# -*- coding: UTF-8 -*- -# Copyright 2014 Red Hat, Inc. -# Part of clufter project -# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt) -"""Bootstrap the environment for testing""" -__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>" - -from sys import modules, path -from os import getcwd -from os.path import basename, dirname, abspath - - -if __name__ != 'main_bootstrap': - # XXX recognize when this file executed directly and report - - # if not run from main-bootstrap, verbose logging desired - from os import environ - import logging - logging.basicConfig() - logging.getLogger().setLevel(environ.get('LOGLEVEL') or logging.DEBUG) - -# in interactive run, we have no __file__ -__file__ = str(globals().get('__file__', '')) # convert from possibly unicode -if __file__: - # inject PYTHONPATH we are to use - root = reduce(lambda x, y: dirname(x), xrange(2), abspath(__file__)) -else: - root = getcwd() -path.insert(0, dirname(root)) - -# set the correct __package__ for relative imports -__package__ = basename(root) -if __package__ not in modules: - modules[__package__] = __import__(__package__) - -# also normalize the __file__ -__file__ = abspath(__file__) - - -# XXX previous attempt to get unittest.main executed automagically at the end, -# which was failing likely because unittest uses Threading that register -# another atexit handler somehow interfering w/ its main started from here -#if __name__ == '__main__': -# def main() -# from atexit import register -# from unittest import main -# register(main) -# # hmm, see https://code.google.com/p/modwsgi/issues/detail?id=197 -# # https://github.com/GrahamDumpleton/mod_wsgi/commit/fdef274 -# register(lambda: __import__('dummy_threading')) +../run-dev
\ No newline at end of file |