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_USER_SETTINGS

If an environment variable named SLASH_USER_SETTINGS exists, the file path it points to will be loaded instead of the slashrc file.

SLASH_SETTINGS

If an environment variable named SLASH_SETTINGS exists, it is assumed to point at a file path or URL to load 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

debug.debug_skips

Default: False

Enter pdb also for SkipTest exceptions

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.filter_strings

Default: []

A string filter, selecting if to enter pdb

debug.debugger

Default: None

log.colorize

Default: False

Emit log colors to files

log.console_theme.dark_background

Default: True

log.console_theme.inline-file-end-fail

Default: red

log.console_theme.inline-file-end-skip

Default: yellow

log.console_theme.inline-file-end-success

Default: green

log.console_theme.inline-error

Default: red

log.console_theme.inline-test-interrupted

Default: yellow

log.console_theme.error-cause-marker

Default: white/bold

log.console_theme.fancy-message

Default: yellow/bold

log.console_theme.frame-local-varname

Default: yellow/bold

log.console_theme.num-collected

Default: white/bold

log.console_theme.session-summary-success

Default: green/bold

log.console_theme.session-summary-failure

Default: red/bold

log.console_theme.session-start

Default: white/bold

log.console_theme.error-separator-dash

Default: red

log.console_theme.tb-error-message

Default: red/bold

log.console_theme.tb-error

Default: red/bold

log.console_theme.tb-frame-location

Default: white/bold

log.console_theme.test-additional-details-header

Default: black/bold

log.console_theme.test-additional-details

Default: black/bold

log.console_theme.test-error-header

Default: white

log.console_theme.test-skip-message

Default: yellow

log.console_theme.tb-line-cause

Default: white

log.console_theme.tb-test-line

Default: red/bold

log.console_theme.tb-line

Default: black/bold

log.console_level

Default: 13

log.core_log_level

Default: 13

Minimal level of slash log messages to show

log.color_console

Default: None

log.repr_blacklisted_types

Default: []

Blacklisted types that should not be repred in traceback

log.traceback_variables

Default: False

Logs values of variables in traceback frames for added errors

log.console_traceback_level

Default: 2

Detail level of tracebacks

log.truncate_console_lines

Default: True

truncate long log lines on the console

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.root

Default: None

Root directory for logs

log.subpath

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

Path to write logs to under the root

log.session_subpath

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

log.highlights_subpath

Default: None

If set, this path will be used to record highlights (eg. errors added) in the session and/or tests

log.show_manual_errors_tb

Default: True

Show tracebacks for errors added via slash.add_error

log.show_raw_param_values

Default: False

Makes test start logs contain the raw values of test parameters

log.silence_loggers

Default: []

Logger names to silence

log.format

Default: None

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

log.console_format

Default: None

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

log.localtime

Default: False

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

log.unittest_mode

Default: False

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

log.unified_session_log

Default: False

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

log.compression.enabled

Default: False

Compress log files

log.compression.algorithm

Default: brotli

Compression algorithm to use, either gzip or brotli

log.compression.use_rotating_raw_file

Default: False

When compression is enabled, write also to uncompressed rotating log file

log.cleanup.enabled

Default: False

log.cleanup.keep_failed

Default: True

run.dump_variation

Default: False

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

run.default_sources

Default: []

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

run.suite_files

Default: []

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

run.stop_on_error

Default: False

Stop execution when a test doesn’t succeed

run.filter_strings

Default: []

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

run.repeat_each

Default: 1

Repeat each test a specified amount of times

run.repeat_all

Default: 1

Repeat all suite a specified amount of times

run.session_state_path

Default: ~/.slash/last_session

Where to keep last session serialized data

run.project_name

Default: None

run.project_customization_file_path

Default: ./.slashrc

run.user_customization_file_path

Default: ~/.slash/slashrc

run.resume_state_path

Default: ~/.slash/session_states

Path to store or load session’s resume data

run.message_assertion_introspection

Default: True

When False, failing assertions which have messages attached will not emit introspection info

run.capture.error_logs_as_errors

Default: False

Add errors for error level logs

interactive.expose_g_globals

Default: True

When False, slash.g won’t be added to interactive test namespaces

interactive.colors

Default: None

IPython color scheme

parallel.num_workers

Default: 0

Parallel execution

parallel.worker_id

Default: None

Worker_id

parallel.server_addr

Default: localhost

Server address

parallel.server_port

Default: 0

Server port

parallel.keepalive_port

Default: 0

Keepalive port

parallel.parent_session_id

Default: None

parent session id

parallel.communication_timeout_secs

Default: 60

timeout of worker in seconds

parallel.worker_connect_timeout

Default: 10

timeout for each worker to connect

parallel.no_request_timeout

Default: 20

timeout for server not getting requests

parallel.worker_error_file

Default: errors-worker

worker error filename template

parallel.workers_error_dir

Default: None

workers error directory

resume.failed_first

Default: False

Run failed tests of previous session before all others

resume.unstarted_first

Default: False

Run unstarted tests of previous session before all others

resume.failed_only

Default: False

Run only failed tests of previous session

resume.unstarted_only

Default: False

Run only unstarted tests of previous session

resume.no_skipped

Default: False

Run tests of previous session without skipped tests

resume.state_retention_days

Default: 10

Number of days to keep session entries for resuming session

tmux.enabled

Default: False

Run inside tmux

tmux.use_panes

Default: False

In parallel mode, run children inside panes and not windows

sentry.dsn

Default: None

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

plugins.search_paths

Default: []

List of paths in which to search for plugin modules

plugin_config.coverage.config_filename

Default: False

Coverage configuration file

plugin_config.coverage.report_type

Default: html

Coverage report format

plugin_config.coverage.report

Default: True

plugin_config.coverage.append

Default: False

Append coverage data to existing file

plugin_config.coverage.sources

Default: []

Modules or packages for which to track coverage

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.notifications.notify_only_on_failures

Default: False

plugin_config.notifications.notify_on_pdb

Default: True

plugin_config.notifications.prowl.api_key

Default: None

plugin_config.notifications.prowl.enabled

Default: True

plugin_config.notifications.nma.api_key

Default: None

plugin_config.notifications.nma.enabled

Default: True

plugin_config.notifications.pushbullet.api_key

Default: None

plugin_config.notifications.pushbullet.enabled

Default: True

plugin_config.notifications.email.from_email

Default: Slash <noreply@getslash.github.io>

plugin_config.notifications.email.smtp_server

Default: None

plugin_config.notifications.email.to_list

Default: []

plugin_config.notifications.email.cc_list

Default: []

plugin_config.notifications.email.enabled

Default: False

plugin_config.notifications.slack.url

Default: None

plugin_config.notifications.slack.channel

Default: None

plugin_config.notifications.slack.from_user

Default: slash-bot

plugin_config.notifications.slack.enabled

Default: False

plugin_config.xunit.filename

Default: testsuite.xml

Name of XML xUnit file to create