blob: fd5a6405608fd6734042f58fa59447aef885f9dd [file] [log] [blame]
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +02001# osmo_gsm_tester: prepare a test run and provide test API
2#
3# Copyright (C) 2016-2017 by sysmocom - s.f.m.c. GmbH
4#
5# Author: Neels Hofmeyr <neels@hofmeyr.de>
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20import sys, os
21import pprint
22import inspect
23
24from . import suite as _suite
25from . import log
26from . import resource
27
28# load the configuration for the test
29suite = _suite.Suite(sys.path[0])
30test = _suite.Test(suite, os.path.basename(inspect.stack()[-1][1]))
31
32def test_except_hook(*exc_info):
33 log.exn_add_info(exc_info, test)
34 log.exn_add_info(exc_info, suite)
35 log.log_exn(exc_info=exc_info)
36
37sys.excepthook = test_except_hook
38
39orig_stdout, sys.stdout = sys.stdout, test
40
41resources = {}
42
43# vim: expandtab tabstop=4 shiftwidth=4