Table Of Contents

This Page

test Package

test Package

Tests can be run with py.test (of the PyPy project) or with nosetest either. nosetest is default with v0.2.0 because PY3k compliance is expected earlier here. @author: Ruben Reifenberg

rrlog.test.run(srcfile, k=None)[source]
Parameters:
  • srcfile – str, filename to test, e.g. sys.argv[0]
  • k – str, run tests starting with regex k.* only. ==The -k parameter of py.test.
rrlog.test.run_nose(srcfile, k=None)[source]
rrlog.test.run_pytest(srcfile, k)[source]

test_core Module

@summary: Test core functionality, Log and LogServer (not the XMLRPC part). Requires py.test from the PyPy project. @author: Ruben Reifenberg

class rrlog.test.test_core.AttrDict(target)[source]

Bases: dict

__init__(target)[source]
class rrlog.test.test_core.TestLogAndServer[source]

Bases: object

_test1()[source]
_test2()[source]
_test3()[source]
_test4()[source]
_test5()[source]
log(msg, **kwargs)[source]
test_12345()[source]
test_seFilesExclude()[source]
test_traceOffset()[source]
class rrlog.test.test_core._TestLogWriter[source]

Bases: object

_count_cfn_in_path(cfn, path)[source]
Returns:how many filenames f are in path where cfn is substring of f ?
Return type:int >= 0
clientid = None
clnExpected = None
currDict = None
fnMatch = None
msgid = 1
stackCheckLimit = 777
thisfnameOccurrences = (0, 777)
writeNow(job)[source]
rrlog.test.test_core.line_xFunction(callable, *args, **kwargs)[source]
rrlog.test.test_core.line_yFunction(callable, *args, **kwargs)[source]
rrlog.test.test_core.setup_module(module)[source]
rrlog.test.test_core.thisfname()[source]
Returns:my filename without path and without py

test_dbwriter_sa Module

@requires: SQLAlchemy 0.4.0 and compatible @summary: Test problem archiver. Disable this test when SQLAlchemy is not available. @author: Ruben Reifenberg

rrlog.test.test_dbwriter_sa.logSequence(rotateCount=3, rotateLineMin=10, lineCount=25, msg='msg%d', observers=(), errorLines=(), drop=True, kwargs={})[source]
Parameters:errorLines – list of linenumbers where an error is logged (0==first line)
rrlog.test.test_dbwriter_sa.logTables(log)[source]
rrlog.test.test_dbwriter_sa.test_individual_cols()[source]

individual str + int column is added

rrlog.test.test_dbwriter_sa.test_individual_cols_defaultvalues()[source]

individual str + int column is added

rrlog.test.test_dbwriter_sa.test_log_SA_112()[source]

cover log writing and rotation

rrlog.test.test_dbwriter_sa.test_log_SA_122()[source]
rrlog.test.test_dbwriter_sa.test_log_SA_123()[source]
rrlog.test.test_dbwriter_sa.test_log_SA_123_drop_norotation()[source]
rrlog.test.test_dbwriter_sa.test_log_SA_123_nodrop_norotation()[source]
rrlog.test.test_dbwriter_sa.test_log_SA_173_catsDisable()[source]
rrlog.test.test_dbwriter_sa.test_log_SA_173_catsEnable()[source]
rrlog.test.test_dbwriter_sa.test_log_SA_223()[source]

test_demo Module

@summary: Covers some of the demo functions. Requires py.test from the PyPy project. @author: Ruben Reifenberg

class rrlog.test.test_demo.OpenFF[source]

Bases: object

fake replacement of the open() function

__call__(path, flag)[source]
__init__()[source]
ff_by_suffix(suffix)[source]

asserts false when >1 result is found :returns: the only item where key ends with suffix

rrlog.test.test_demo.demopath()[source]

find the path to the documentations demo/ directory because the files there are part of the tests.

rrlog.test.test_demo.regex_for_path(cfunc, fname, demo_cln, restcount, democount, omittedcxn='')[source]
Parameters:
  • restcount – anonymous path components on the right
  • democount – call count inside fname (incl.cfn)
  • omittedcxn – cfn/cln replacement when omitted
rrlog.test.test_demo.setup()[source]

the demo directory is usually not in sys.path (it’s considered to be part of the doc) append it

rrlog.test.test_demo.teardown()[source]
rrlog.test.test_demo.test_demo_customlinefiles()[source]

nearly like usingFiles

rrlog.test.test_demo.test_demo_files()[source]
rrlog.test.test_demo.test_demo_indentfiles()[source]
rrlog.test.test_demo.test_demo_indentstdout()[source]
rrlog.test.test_demo.test_demo_logginghandler()[source]
rrlog.test.test_demo.test_demo_stdout()[source]

test_filewriter Module

@summary: Test file writer/ file rotation. Requires py.test from the PyPy project. @author: Ruben Reifenberg

class rrlog.test.test_filewriter.FakeFile(config)[source]

Bases: object

__init__(config)[source]
close()[source]
flush()[source]
instances = []
classmethod reset()[source]
write(line)[source]
class rrlog.test.test_filewriter.FakeFileLogWriter(config, format_line=None, fileClosed=None)[source]

Bases: rrlog.server.filewriter.FileLogWriter

_createFile()[source]
rrlog.test.test_filewriter.logSequence(rotateCount=3, rotateLineMin=10, lineCount=25, msg='msg<%d>', observers=(), errorLines=(), drop=True, kwargs={})[source]
Parameters:errorLines – list of linenumbers where an error is logged (0==first line)
rrlog.test.test_filewriter.test_f_100_10_1000()[source]

higher numbers to cover job reusage (job pooling)

rrlog.test.test_filewriter.test_f_112()[source]

cover log writing and rotation

rrlog.test.test_filewriter.test_f_122()[source]
rrlog.test.test_filewriter.test_f_123()[source]
rrlog.test.test_filewriter.test_f_223()[source]
rrlog.test.test_filewriter.test_f_2x3_catsDisable()[source]
rrlog.test.test_filewriter.test_f_2x3_catsEnable()[source]
rrlog.test.test_filewriter.test_f_norotation()[source]
rrlog.test.test_filewriter.test_format_line()[source]

format_line argument

test_mail Module

class rrlog.test.test_mail.Job(cat, msg)[source]

Bases: object

__init__(cat, msg)[source]
class rrlog.test.test_mail.Mailer[source]

Bases: object

__init__()[source]
expecteds = [('W', 'Hello'), ('E', 'World')]
mail(lines)[source]
rrlog.test.test_mail.format_line(job, lineCount)[source]
rrlog.test.test_mail.now()

[tz] -> new datetime with tz’s local day and time.

rrlog.test.test_mail.test_catbuffer_0()[source]

empty rules

rrlog.test.test_mail.test_catbuffer_1()[source]

single rule

rrlog.test.test_mail.test_catbuffer_catchall()[source]

single “catchall” rule

rrlog.test.test_mail.test_catbuffer_deadlines()[source]

2 rules, check deadlines

rrlog.test.test_mail.test_whole()[source]

test_observers Module

@summary: Test both observer & filter functionality @author: Ruben Reifenberg

class rrlog.test.test_observers.Checker(expected_msgs, raiseon=None)[source]

Bases: object

__call__(jobhist, writer)[source]
__init__(expected_msgs, raiseon=None)[source]
Parameters:raiseon – raise ValueError when that message appears (==simulate internal error)
assert_finished()[source]
class rrlog.test.test_observers.LegacyObserver(expected_msgs, raiseon=None)[source]

Bases: rrlog.test.test_observers.Checker

same but with observe() methode instead __call__()

__call__(*args, **kwargs)[source]
observe(*args, **kwargs)[source]
rrlog.test.test_observers.format_line(job)[source]
rrlog.test.test_observers.test_filters()[source]

filters added and called ?

rrlog.test.test_observers.test_observers()[source]

observers added and called ?

test_printwriter Module

@summary: Test print writer (analogous to file writer test) @author: Ruben Reifenberg

class rrlog.test.test_printwriter.FakeFile[source]

Bases: object

__init__()[source]
close()[source]
flush()[source]
instances = []
classmethod reset()[source]
write(line)[source]
rrlog.test.test_printwriter.logSequence(lineCount=25, msg='msg<%d>', errorLines=(), drop=True, modifylog=None, kwargs={})[source]
Parameters:errorLines – list of linenumbers where an error is logged (0==first line)
rrlog.test.test_printwriter.test_f_100_10_1000()[source]

higher numbers to cover job reusage (job pooling)

rrlog.test.test_printwriter.test_f_122()[source]
rrlog.test.test_printwriter.test_f_2x3_catsDisable()[source]
rrlog.test.test_printwriter.test_f_2x3_catsEnable()[source]
rrlog.test.test_printwriter.test_format_line()[source]

format_line argument

test_stackindent Module

@summary: Test line indention by stack depth Requires py.test from the PyPy project. @author: Ruben Reifenberg

class rrlog.test.test_stackindent.SimpleFileLogWriter(config, format_line=None, fileClosed=None)[source]

Bases: rrlog.test.test_filewriter.FakeFileLogWriter

_format_line(job)[source]

msg only

rrlog.test.test_stackindent.create(msgPrefix=None)[source]
rrlog.test.test_stackindent.f1(log)[source]
rrlog.test.test_stackindent.f2(log)[source]
rrlog.test.test_stackindent.f3(log)[source]
rrlog.test.test_stackindent.f4(log)[source]
rrlog.test.test_stackindent.f5(log)[source]
rrlog.test.test_stackindent.format_line(job, lineCount)[source]
rrlog.test.test_stackindent.fp1(log)[source]
rrlog.test.test_stackindent.fp2(log)[source]
rrlog.test.test_stackindent.fp3(log)[source]
rrlog.test.test_stackindent.test_msgPrefix()[source]
rrlog.test.test_stackindent.test_tara_0()[source]
rrlog.test.test_stackindent.test_tara_m2()[source]

test_tool Module

@summary: Test the tool module. Requires py.test from the PyPy project. @author: Ruben Reifenberg

rrlog.test.test_tool.test_ListRotator()[source]
rrlog.test.test_tool.test_cutcount()[source]
rrlog.test.test_tool.test_lu2a()[source]
rrlog.test.test_tool.test_lu2a_de()[source]
rrlog.test.test_tool.test_mStrftime()[source]