def test_msgs(): from pypit import ardebug from pypit import armsgs as pyparm debug = ardebug.init() msgs = pyparm.Messages(None, debug, 1) msgs.info("test 123") msgs.warn("test 123") msgs.bug("test 123") msgs.work("test 123") msgs.close()
def get_dummy_logger(): """ Useful for testing Returns ------- """ from pypit import ardebug from pypit import armsgs as pyparm debug = ardebug.init() pyparm.pypit_logger = pyparm.Messages(None, debug, 1) return pyparm.pypit_logger
def get_dummy_logger(develop=False): """ Useful for testing Returns ------- """ from pypit import ardebug from pypit import armsgs as pyparm debug = ardebug.init() debug['develop'] = develop pyparm.pypit_logger = pyparm.Messages(None, debug, 0) return pyparm.pypit_logger
def test_log_write(): from pypit import ardebug from pypit import armsgs as pyparm debug = ardebug.init() outfil = 'tst.log' msgs = pyparm.Messages(outfil, debug, 1) msgs.close() # Insure scipy, numpy, astropy are being version with open(outfil, 'r') as f: lines = f.readlines() pckgs = ['scipy', 'numpy', 'astropy'] flgs = [False]*len(pckgs) for line in lines: for jj,pckg in enumerate(pckgs): if pckg in line: flgs[jj] = True for flg in flgs: assert flg is True