etr  2.0
 All Classes Namespaces Files Functions Variables Groups Pages
Modules | Files | Classes | Functions
Main Project

Etr Test Runner. More...

Modules

 Robot Framework Libraries
 Robot Framework libraries provided by etr.
 

Files

file  __init__.py
 
file  command.py
 
file  context.py
 
file  exception.py
 
file  info.py
 
file  main.py
 
file  plugin.py
 etr plugin manager
 
file  jinja2.py
 
file  nomad.py
 
file  nose.py
 
file  resources.py
 
file  __init__.py
 Robot Framework plugin for etr.
 
file  result.py
 
file  runner.py
 
file  manager.py
 
file  console.py
 
file  fsisolation.py
 
file  logcapture.py
 
file  subprocess.py
 
file  tests.py
 
file  xunit.py
 
file  etr.py
 
file  wscript
 
file  etr.py
 
file  __init__.py
 
file  command.py
 
file  context.py
 
file  exception.py
 
file  info.py
 
file  main.py
 
file  plugin.py
 etr plugin manager
 
file  jinja2.py
 
file  nomad.py
 
file  nose.py
 
file  resources.py
 
file  __init__.py
 Robot Framework plugin for etr.
 
file  result.py
 
file  runner.py
 
file  manager.py
 
file  console.py
 
file  fsisolation.py
 
file  logcapture.py
 
file  subprocess.py
 
file  tests.py
 
file  xunit.py
 

Classes

class  etr.context.Command
 Application commands enumeration. More...
 
class  etr.context.Step
 Main execution steps for the test command. More...
 
class  etr.exception.UserError
 A user error should never result in a back trace but a user friendly message about the error. More...
 
class  etr.exception.DeferredException
 Exception indicating that one or more exceptions was caught but execution should not stop so the error was deferred and this exception was thrown after the execution. More...
 
class  etr.exception.AbortException
 Exception indicating that test execution is aborted by user. More...
 
class  etr.exception.TransientException
 Exception indicating a transient error. More...
 
class  etr.exception.ExternalException
 Exception indicating that an error occurred due to external circumstance with user provided data. More...
 
class  etr.info.InfoRegister
 Class holding general information about a test session. More...
 
class  etr.plugin.Plugin
 Plugin base class to simplify implementation. More...
 
class  etr.plugin.PluginMgr
 Plugin instance manager. More...
 
class  etr.plugin.PluginRegister
 Plugin register containing types but not instances of plugins. More...
 
class  etr.plugins.jinja2.Renderer
 Jinja renderer. More...
 
class  etr.plugins.resources.Storage
 Provides the storage abstraction for Resources. More...
 
class  etr.plugins.resources.RemoteService
 Adapter for the remote resource manager service. More...
 
class  etr.plugins.resources.LocalResources
 Acquire/release local resources, as specified by config files. More...
 
class  etr.plugins.resources.ResourceManager
 Resource Manager that acquires and releases resources as well as keeping the record of acquired/released resources. More...
 
class  etr.result.ExitCode
 Application exit codes Codes are ordered by severity such that the highest number is reported. More...
 
class  etr.result.TextTestResult
 Outputs test results as text on a stream. More...
 
class  etr.runner.Runner
 ESO Test Facility Runner. More...
 
class  etr.storage.manager.CommitContext
 Context manager that does automatic commits if no errors occur. More...
 
class  etr.storage.manager.StorageManager
 Provides the storage abstraction for etr. More...
 
class  etr.tools.logcapture.CaptureHandler
 Captures logs into a line-buffer (list). More...
 
class  etr.tools.logcapture.LogCapture
 Captures log messages into a memory buffer and allows on-demand writing captured messages to stderr. More...
 
class  etr.tools.subprocess.SignalContextManager
 Provides a context manager to be able to captue signals and forward them to a subprocess within a context manager scope. More...
 
class  etr.tools.subprocess.KillOrphansContextManager
 Use instead of popen to perform cleanup of orphan subprocesses. More...
 
class  etr.tools.xunit.TestCaseResult
 Result of a test case. More...
 

Functions

def etr.main.main
 etr entrypoint More...
 
def etr.plugin.plugin
 Class decorator that registers the class as a plugin. More...
 
def etr.result.pretty_time_delta
 Prints elapsed time in a pretty format. More...
 
def etr.runner.parse_steps
 Parse value and return a list with steps parsed with the following rules: More...
 
def etr.runner.parse_command
 Parses the command enum strings and returns a Command enum. More...
 
def etr.tools.console.to_console
 Print msg to both console and logger. More...
 
def etr.tools.subprocess.cmd_and_log
 Runs command and logs to line_handler. More...
 
def etr.tools.tests.make_basename
 Helper that creates a unified basename out of the test index and the test file path. More...
 
def etr.tools.tests.make_tests
 Helper that creates the list of tests execute. More...
 
def etr.tools.xunit.parse_ts
 Parse <testsuite> element. More...
 
def etr.tools.xunit.parse_root
 Parse xunit root element. More...
 
def etr.tools.xunit.parse
 Parse xunit file, or file-like object. More...
 

Detailed Description

Etr Test Runner.

Function Documentation

def etr.tools.subprocess.cmd_and_log (   command)

Runs command and logs to line_handler.

It can also generate a script file that re-creates the execution environment which can be useful for debugging outside etr.

Parameters
commandCommand to execute.
kill_orphansWhether to kill orphaned processes or not. Default is True.
line_handlerCallback invoked for each line of output of command
script_fileWhether or not to generate a script file that reproduce the command invocation.
Returns
None
def etr.main.main ( )

etr entrypoint

def etr.tools.tests.make_basename (   index,
  test_file_path 
)

Helper that creates a unified basename out of the test index and the test file path.

make_basename(0, 'src/test.robot')

'00_test'

def etr.tools.tests.make_tests (   tests)

Helper that creates the list of tests execute.

Additionally, it implements standard features that should be valid across any test runner plugin. These are:

  • Test randomization
  • Test selection/filtering

Returns an ordered list (that may be shuffled) of tuples where each tuple contains the original sequence and the test filename, e.g.:

[(12, 'src/some_test.robot'), (1, 'src/other_test.robot'), ...]

def etr.tools.xunit.parse (   xunit_file)

Parse xunit file, or file-like object.

def etr.runner.parse_command (   scmd)

Parses the command enum strings and returns a Command enum.

parse_command('test').name

'TEST'

parse_command('clean').name

'CLEAN'

parse_command('info').name

'INFO'

def etr.tools.xunit.parse_root (   root)

Parse xunit root element.

Returns a list of TestSuiteResult instances

The xunit xml schema also contains aggregate information, but we skip that bit and process info from the parsed testcases.

def etr.runner.parse_steps (   val)

Parse value and return a list with steps parsed with the following rules:

Single step e.g. 'setup':

[s.name for s in parse_steps('setup')]

['SETUP']

Starting at a step and continuing to the end: 'start:'

[s.name for s in parse_steps('setup:')]

['SETUP', 'RUN', 'TEARDOWN']

Starting from the beginning and run to specified step ':end':

[s.name for s in parse_steps(':run')]

['SETUP', 'RUN']

Starting from specified and ending at a specified step:

[s.name for s in parse_steps('run:teardown')]

['RUN', 'TEARDOWN']

Executing steps in reverse order is illegal:

parse_steps('teardown:run') # doctest: +ELLIPSIS

Traceback (most recent call last): ... etr Can only run the step sequence in order...

def etr.tools.xunit.parse_ts (   elem)

Parse <testsuite> element.

def etr.plugin.plugin (   name)

Class decorator that registers the class as a plugin.

Although not it's not necessary that plugins inherit from Plugin, they need to implement the same methods.

@plugin('myplugin')
class MyPlugin(Plugin):

    @classmethod
    def add_options(cls, parser):
        '''Optional

        Used to add custom command line options.

        @note: Must be a static method.
        '''
        pass

    def setup(self, ctx:SetupContext):
        '''Optional

        Called during setup step
        '''
        pass

    def run(self, ctx:RunContext):
        '''Optional

        Called during run
        '''
        pass

    def teardown(self, ctx:TeardownContext):
        '''Optional

        Called during teardown
        '''
        pass
def etr.result.pretty_time_delta (   seconds)

Prints elapsed time in a pretty format.

pretty_time_delta(7.1)

'7.1s'

pretty_time_delta(30*60 + 1)

'30m 1s'

pretty_time_delta(3601)

'1h 0m 1s'

def etr.tools.console.to_console (   msg,
  file = None 
)

Print msg to both console and logger.