Package pypower :: Package t :: Module t_begin
[hide private]
[frames] | no frames]

Source Code for Module pypower.t.t_begin

 1  # Copyright (C) 2004-2011 Power System Engineering Research Center (PSERC) 
 2  # Copyright (C) 2011 Richard Lincoln 
 3  # 
 4  # PYPOWER is free software: you can redistribute it and/or modify 
 5  # it under the terms of the GNU General Public License as published 
 6  # by the Free Software Foundation, either version 3 of the License, 
 7  # or (at your option) any later version. 
 8  # 
 9  # PYPOWER is distributed in the hope that it will be useful, 
10  # but WITHOUT ANY WARRANTY without even the implied warranty of 
11  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
12  # GNU General Public License for more details. 
13  # 
14  # You should have received a copy of the GNU General Public License 
15  # along with PYPOWER. If not, see <http://www.gnu.org/licenses/>. 
16   
17  """Global test counters initialization. 
18  """ 
19   
20  from time import time 
21   
22  from pypower.t.t_globals import TestGlobals 
23   
24   
25 -def t_begin(num_of_tests, quiet=False):
26 """Initializes the global test counters, setting everything up to 27 execute C{num_of_tests} tests using C{t_ok} and C{t_is}. If C{quiet} 28 is true, it will not print anything for the individual tests, only a 29 summary when C{t_end} is called. 30 31 @author: Ray Zimmerman (PSERC Cornell) 32 @author: Richard Lincoln 33 """ 34 35 TestGlobals.t_quiet = quiet 36 TestGlobals.t_num_of_tests = num_of_tests 37 TestGlobals.t_counter = 1 38 TestGlobals.t_ok_cnt = 0 39 TestGlobals.t_not_ok_cnt = 0 40 TestGlobals.t_skip_cnt = 0 41 TestGlobals.t_clock = time() 42 43 if not TestGlobals.t_quiet: 44 print '1..%d' % num_of_tests
45