Layers

Any of runnable objects can has layers for expanded logic on different levels. Layers is chain of callbacks. Context object call to chain of layers, it is responsible for that.

Program layer

class seismograph.program.ProgramLayer
on_config(config)
on_error(error, program, result)
on_init(program)
on_option_parser(parser)
Parameters:parser – optparse.OptionParser
on_run(program)
on_setup(program)
on_teardown(program)
import seismograph


class ExampleProgramLayer(seismograph.ProgramLayer):
    pass


class ExampleProgram(seismograph.Program):

    __layers__ = (
        ExampleProgramLayer(),
    )


# or


program = seismograph.Program(layers=[ExampleProgramLayer()])

Suite layer

class seismograph.suite.SuiteLayer
on_build_rule(suite, rule)
on_error(error, suite, result)
on_init(suite)
on_mount(suite, program)
on_require(require)
on_run(suite)
on_setup(suite)
on_teardown(suite)
import seismograph


class ExampleSuiteLayer(seismograph.SuiteLayer):
    pass


class ExampleSuite(seismograph.Suite):

    __layers__ = (
        ExampleSuiteLayer(),
    )


# or


suite = seismograph.Suite(__name__, layers=[ExampleSuiteLayer()])

Case layer

class seismograph.case.CaseLayer
on_any_error(error, case, result)
on_context_error(error, case, result)
on_error(error, case, result)
on_fail(fail, case, result)
on_init(case)
on_require(require)
on_run(case)
on_setup(case)
on_skip(case, reason, result)
on_success(case)
on_teardown(case)
import seismograph


class ExampleCaseLayer(seismograph.CaseLayer):
    pass


class ExampleCase(seismograph.Case):

    __layers__ = (
        ExampleCaseLayer(),
    )


# or


suite = seismograph.Suite(__name__)


@suite.register(layers=[ExampleCaseLayer()])
class ExampleCase2(seismograph.Case):
    pass