From 7fb4dee193f56b0b3f43c6fc8560bd1569b9bd30 Mon Sep 17 00:00:00 2001 From: Jan Pokorný Date: Fri, 19 Sep 2014 13:53:56 +0200 Subject: Make run-dev central point for local use (e.g., test run) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Pokorný --- tests/_bootstrap.py | 51 +-------------------------------------------------- 1 file changed, 1 insertion(+), 50 deletions(-) mode change 100644 => 120000 tests/_bootstrap.py (limited to 'tests/_bootstrap.py') diff --git a/tests/_bootstrap.py b/tests/_bootstrap.py deleted file mode 100644 index 70b95bc..0000000 --- a/tests/_bootstrap.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- 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ý " - -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')) diff --git a/tests/_bootstrap.py b/tests/_bootstrap.py new file mode 120000 index 0000000..6a45d62 --- /dev/null +++ b/tests/_bootstrap.py @@ -0,0 +1 @@ +../run-dev \ No newline at end of file -- cgit