blob: 49911b3f89def237acfb5ffecf181540c8eb4004 [file] [log] [blame]
Neels Hofmeyr3531a192017-03-28 14:30:28 +02001# osmo_gsm_tester: context for individual test runs
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +02002#
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
Harald Welte27205342017-06-03 09:51:45 +02008# it under the terms of the GNU General Public License as
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +02009# 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
Harald Welte27205342017-06-03 09:51:45 +020015# GNU General Public License for more details.
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020016#
Harald Welte27205342017-06-03 09:51:45 +020017# You should have received a copy of the GNU General Public License
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020018# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
Neels Hofmeyr3531a192017-03-28 14:30:28 +020020# These will be initialized before each test run.
21# A test script can thus establish its context by doing:
22# from osmo_gsm_tester.test import *
23trial = None
24suite = None
25test = None
26resources = None
27log = None
28dbg = None
29err = None
30wait = None
Pau Espin Pedrol927344b2017-05-22 16:38:49 +020031wait_no_raise = None
Neels Hofmeyr3531a192017-03-28 14:30:28 +020032sleep = None
33poll = None
34prompt = None
Neels Hofmeyra88b0c72017-05-07 02:15:48 +020035Timeout = None
Pau Espin Pedrol2d16f6f2017-05-30 15:33:57 +020036Sms = None
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020037
Pau Espin Pedrol2d16f6f2017-05-30 15:33:57 +020038def setup(suite_run, _test, ofono_client, suite_module, event_module, sms_module):
39 global trial, suite, test, resources, log, dbg, err, wait, wait_no_raise, sleep, poll, prompt, Timeout, Sms
Neels Hofmeyr3531a192017-03-28 14:30:28 +020040 trial = suite_run.trial
41 suite = suite_run
42 test = _test
43 resources = suite_run.reserved_resources
44 log = test.log
45 dbg = test.dbg
46 err = test.err
Pau Espin Pedrol927344b2017-05-22 16:38:49 +020047 wait = lambda *args, **kwargs: event_module.wait(suite_run, *args, **kwargs)
48 wait_no_raise = lambda *args, **kwargs: event_module.wait_no_raise(suite_run, *args, **kwargs)
49 sleep = lambda *args, **kwargs: event_module.sleep(suite_run, *args, **kwargs)
50 poll = event_module.poll
Neels Hofmeyr3531a192017-03-28 14:30:28 +020051 prompt = suite_run.prompt
Neels Hofmeyra88b0c72017-05-07 02:15:48 +020052 Timeout = suite_module.Timeout
Pau Espin Pedrol2d16f6f2017-05-30 15:33:57 +020053 Sms = sms_module.Sms
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020054
Neels Hofmeyrdae3d3c2017-03-28 12:16:58 +020055# vim: expandtab tabstop=4 shiftwidth=4