PK+ None: logger.debug("Starting...") arg_dict = dict() arg_dict['args'] = args arg_dict['kwargs'] = kwargs logger.debug("args/kwargs = {}".format(arg_dict)) start = time.time() result = function(*args, **kwargs) end = time.time() logger.debug("Return Value: '{}'".format(result)) logger.info("...Finished ({} seconds)".format(end - start)) return result return wrapper PKT str: """ Returns a str made from static text, a passed str, and a passed int. :param a_string: a str to be used in the returned string :param an_int: an int to be used in the returned string :return: a str which includes both a_string and an_int values """ return "Your str was '{}' and your int was '{}'.".format(a_string, an_int) @given(t_str=text(alphabet='azbef'), t_int=integers()) def test_iologger_runs(t_str, t_int): assert logged_function(a_string=t_str, an_int=t_int) @given(t_str=permutations('azbef'), t_int=integers()) @pytest.mark.usefixtures('setup_logging') def test_args_logging(t_str, t_int): with StringIO() as logfile: stdout_handler = StreamHandler(logfile) stdout_handler.push_application() t_str = ''.join(t_str) logged_function(a_string=t_str, an_int=t_int) assert t_str in logfile.getvalue() assert str(t_int) in logfile.getvalue() stdout_handler.pop_application() @given(t_str=text(alphabet='azbef'), t_int=integers()) @pytest.mark.usefixtures('setup_logging') def test_iologger_debug_level(t_str, t_int): with StringIO() as logfile: stdout_handler = StreamHandler(logfile) stdout_handler.push_application() t_str = ''.join(t_str) logged_function(a_string=t_str, an_int=t_int) assert "Starting" in logfile.getvalue() assert "args/kwargs" in logfile.getvalue() assert "Finished" in logfile.getvalue() assert logfile.getvalue() assert len(logfile.getvalue().splitlines()) == 4 stdout_handler.pop_application() @given(t_str=text(alphabet='azbef'), t_int=integers()) @pytest.mark.usefixtures('setup_logging') def test_iologger_info_level(t_str, t_int): with StringIO() as logfile: stdout_handler = StreamHandler(logfile, level="INFO") stdout_handler.push_application() t_str = ''.join(t_str) logged_function(a_string=t_str, an_int=t_int) assert "Starting" not in logfile.getvalue() assert "args/kwargs" not in logfile.getvalue() assert "Finished" in logfile.getvalue() assert logfile.getvalue() assert len(logfile.getvalue().splitlines()) == 1 stdout_handler.pop_application() @given(t_str=text(alphabet='azbef'), t_int=integers()) @pytest.mark.usefixtures('setup_logging') def test_iologger_notice_level(t_str, t_int): with StringIO() as logfile: stdout_handler = StreamHandler(logfile, level="NOTICE") stdout_handler.push_application() t_str = ''.join(t_str) logged_function(a_string=t_str, an_int=t_int) assert "Starting" not in logfile.getvalue() assert "args/kwargs" not in logfile.getvalue() assert "Finished" not in logfile.getvalue() assert logfile.getvalue() == "" stdout_handler.pop_application() if __name__ == "__main__": pytest.main(['-v']) PK!H|&Ubiologger-1.0.2.dist-info/WHEEL HM K-*ϳR03rOK-J,/RH,Q034 /, (-JLR()*M ILR(4KM̫#DPK!HMIOT!iologger-1.0.2.dist-info/METADATAmN0y 'iEQm*Q~[MLcBi"=zٝA7n@ $O {u[K Mɂ34А$ĕ49׊9IJi ^:mEp(C&hYWqe==e,ʤ>B.ATpS,֙X+ޓ)IS.\k_~_^/_r?ka ºL0\&tB+fTC!1ـ([VmtJOC<\HP u&H;@!TqDfHQ}&4[ǭt:Э'$?PK!H*miologger-1.0.2.dist-info/RECORDu;0޳D$`[o3htB #rg 6LPt냆Д!)vؽ1Oh *V']yqoJ*^U0&Vvɷ+7H$5PQM)X/= =on%{iKQxCϻDy/*~ fšM9Y8~yI:kjND,9.ʽ}]1/PK+