move some functions from 'test/test_py_d/common.py' to 'test/common.py'
This commit is contained in:
parent
7311f47467
commit
e81b4094e3
3 changed files with 27 additions and 24 deletions
|
|
@ -136,3 +136,29 @@ def init_coverage():
|
|||
try: os.mkdir(coverdir,0o755)
|
||||
except: pass
|
||||
return coverdir,acc_file
|
||||
|
||||
devnull_fh = open(('/dev/null','null.out')[g.platform == 'win'],'w')
|
||||
def silence():
|
||||
if not (opt.verbose or (hasattr(opt,'exact_output') and opt.exact_output)):
|
||||
g.stdout = g.stderr = devnull_fh
|
||||
|
||||
def end_silence():
|
||||
if not (opt.verbose or (hasattr(opt,'exact_output') and opt.exact_output)):
|
||||
g.stdout = sys.stdout
|
||||
g.stderr = sys.stderr
|
||||
|
||||
def omsg(s):
|
||||
sys.stderr.write(s + '\n')
|
||||
def omsg_r(s):
|
||||
sys.stderr.write(s)
|
||||
sys.stderr.flush()
|
||||
def imsg(s):
|
||||
if opt.verbose or (hasattr(opt,'exact_output') and opt.exact_output):
|
||||
omsg(s)
|
||||
def imsg_r(s):
|
||||
if opt.verbose or (hasattr(opt,'exact_output') and opt.exact_output):
|
||||
omsg_r(s)
|
||||
def iqmsg(s):
|
||||
if not opt.quiet: omsg(s)
|
||||
def iqmsg_r(s):
|
||||
if not opt.quiet: omsg_r(s)
|
||||
|
|
|
|||
|
|
@ -80,29 +80,6 @@ def confirm_continue():
|
|||
else:
|
||||
raise KeyboardInterrupt('Exiting at user request')
|
||||
|
||||
def omsg(s):
|
||||
sys.stderr.write(s + '\n')
|
||||
def omsg_r(s):
|
||||
sys.stderr.write(s)
|
||||
def imsg(s):
|
||||
if opt.exact_output or opt.verbose: omsg(s)
|
||||
def imsg_r(s):
|
||||
if opt.exact_output or opt.verbose: omsg_r(s)
|
||||
def iqmsg(s):
|
||||
if not opt.quiet: omsg(s)
|
||||
def iqmsg_r(s):
|
||||
if not opt.quiet: omsg_r(s)
|
||||
|
||||
devnull_fh = open(('/dev/null','null.out')[g.platform == 'win'],'w')
|
||||
def silence():
|
||||
if not (opt.verbose or opt.exact_output):
|
||||
g.stdout = g.stderr = devnull_fh
|
||||
|
||||
def end_silence():
|
||||
if not (opt.verbose or opt.exact_output):
|
||||
g.stdout = sys.stdout
|
||||
g.stderr = sys.stderr
|
||||
|
||||
def randbool():
|
||||
return os.urandom(1).hex()[0] in '02468ace'
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ ts_autosign.py: Autosign tests for the test.py test suite
|
|||
import os,shutil
|
||||
from mmgen.globalvars import g
|
||||
from mmgen.opts import opt
|
||||
from test.common import read_from_file
|
||||
from test.common import *
|
||||
from test.test_py_d.common import *
|
||||
|
||||
from test.test_py_d.ts_base import *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue