Configuration

Slash uses a hierarchical configuration structure provided by Confetti. The configuration values are addressed by their full path (e.g. debug.enabled, meaning the value called ‘enabled’ under the branch ‘debug’).

Note

You can inspect the current paths, defaults and docs for Slash’s configuration via the slash list-config command from your shell

Several ways exist to modify configuration values.

Overriding Configuration Values via Command-Line

When running tests via slash run, you can use the -o flag to override configuration values:

$ slash run -o hooks.swallow_exceptions=yes ...

Note

Configuration values get automatically converted to their respective types. More specifically, boolean values also recognize yes and no as valid values.

Customization Files

There are several locations in which you can store files that are to be automatically executed by Slash when it runs. These files can contain code that overrides configuration values:

slashrc file
If the file ~/.slash/slashrc (See run.user_customization_file_path) exists, it is loaded and executed as a regular Python file by Slash on startup.
SLASH_SETTINGS
If an environment variable named SLASH_SETTINGS exists, it is assumed to point at a file path or URL to laod as a regular Python file on startup.

Each of these files can contain code which, among other things, can modify Slash’s configuration. The configuration object is located in slash.config, and modified through slash.config.root as follows:

# ~/.slash/slashrc contents
import slash

slash.config.root.debug.enabled = False

List of Available Configuration Values

plugin_config.notifications.prowl_api_key

Default: None

plugin_config.notifications.nma_api_key

Default: None

plugin_config.notifications.pushbullet_api_key

Default: None

plugin_config.notifications.notification_threshold

Default: 5

plugin_config.coverage.report

Default: True

plugin_config.coverage.sources

Default: []

Modules or packages for which to track coverage

plugin_config.coverage.report_type

Default: html

Coverage report format

plugin_config.coverage.config_filename

Default: False

Coverage configuration file

plugin_config.coverage.append

Default: False

Append coverage data to existing file

plugin_config.xunit.filename

Default: testsuite.xml

Name of XML xUnit file to create

run.suite_files

Default: []

File(s) to be read for lists of tests to be run

run.default_sources

Default: []

Default tests to run assuming no other sources are given to the runner

run.repeat_each

Default: 1

Repeat each test a specified amount of times

run.session_state_path

Default: ~/.slash/last_session

Where to keep last session serialized data

run.project_customization_file_path

Default: ./.slashrc

run.user_customization_file_path

Default: ~/.slash/slashrc

run.stop_on_error

Default: False

Stop execution when a test doesn’t succeed

run.repeat_all

Default: 1

Repeat all suite a specified amount of times

run.dump_variation

Default: False

Output the full variation structure before each test is run (mainly used for internal debugging)

run.filter_strings

Default: []

A string filter, selecting specific tests by string matching against their name

log.silence_loggers

Default: []

Logger names to silence

log.console_format

Default: None

Optional format to be used for console output. Defaults to the regular format

log.format

Default: None

Format of the log line, as passed on to logbook. None will use the default format

log.show_manual_errors_tb

Default: True

Show tracebacks for errors added via slash.add_error

log.console_theme.test-additional-details-header

Default: black/bold

log.console_theme.session-summary-success

Default: green/bold

log.console_theme.inline-file-end-fail

Default: red

log.console_theme.inline-test-interrupted

Default: yellow

log.console_theme.tb-line-cause

Default: white

log.console_theme.inline-error

Default: red

log.console_theme.tb-frame-location

Default: white/bold

log.console_theme.test-additional-details

Default: black/bold

log.console_theme.session-summary-failure

Default: red/bold

log.console_theme.tb-error

Default: red/bold

log.console_theme.error-separator-dash

Default: red

log.console_theme.test-error-header

Default: white

log.console_theme.error-cause-marker

Default: white/bold

log.console_theme.frame-local-varname

Default: yellow/bold

log.console_theme.tb-test-line

Default: red/bold

log.console_theme.inline-file-end-success

Default: green

log.console_theme.fancy-message

Default: yellow/bold

log.console_theme.tb-error-message

Default: red/bold

log.console_theme.test-skip-message

Default: yellow

log.console_theme.tb-line

Default: black/bold

log.console_theme.inline-file-end-skip

Default: yellow

log.colorize

Default: False

Emit log colors to files

log.unified_session_log

Default: False

Make the session log file contain all logs, including from tests

log.traceback_level

Default: 2

Detail level of tracebacks

log.truncate_console_errors

Default: False

If truncate_console_lines is set, also truncate long log lines, including and above the “error” level, on the console

log.session_subpath

Default: {context.session.id}/session.log

log.subpath

Default: {context.session.id}/{context.test_id}/debug.log

Path to write logs to under the root

log.truncate_console_lines

Default: True

truncate long log lines on the console

log.unittest_mode

Default: False

Used during unit testing. Emit all logs to stderr as well as the log files

log.errors_subpath

Default: None

If set, this path will be used to record errors added in the session and/or tests

log.root

Default: None

Root directory for logs

log.console_level

Default: 13

log.localtime

Default: False

Use local time for logging. If False, will use UTC

plugins.search_paths

Default: []

List of paths in which to search for plugin modules

debug.debug_hook_handlers

Default: False

Enter pdb also for every exception encountered in a hook/callback. Only relevant when debugging is enabled

debug.enabled

Default: False

Enter pdb on failures and errors

debug.debugger

Default: None

debug.debug_skips

Default: False

Enter pdb also for SkipTest exceptions

sentry.dsn

Default: None

Possible DSN for a sentry service to log swallowed exceptions. See http://getsentry.com for details