Example #1
0
class BasicUsageTest(TestCase):

    def setUp(self):
        super(BasicUsageTest, self).setUp()
        self.conf = Config(dict(
            a=dict(
                b=2
            )
        ))

    def test__getting(self):
        self.assertEquals(self.conf.root.a.b, 2)

    def test__setting(self):
        self.conf.root.a.b = 3
        self.assertEquals(self.conf.root.a.b, 3)

    def test__get_conf_from_proxy(self):
        self.assertIs(get_config_object_from_proxy(self.conf.root), self.conf)

    def test__proxy_dir(self):
        self.assertEquals(dir(self.conf.root), ['a'])
        self.assertEquals(dir(self.conf.root.a), ['b'])

    def test__pop(self):
        self.assertEquals(list(self.conf['a'].keys()), ['b'])
        self.conf['a'].pop('b')
        self.assertEquals(list(self.conf['a'].keys()), [])

    def test__setting_existing_paths_through_setitem(self):
        self.conf["a"]["b"] = 3
        self.assertEquals(self.conf.root.a.b, 3)

    def test__setting_existing_paths_through_assign_path(self):
        self.conf.assign_path('a.b', 3)
        self.assertEquals(self.conf.root.a.b, 3)

    def test__setting_nonexistent_paths(self):
        with self.assertRaises(exceptions.CannotSetValue):
            self.conf['a']['c'] = 4
        with self.assertRaises(AttributeError):
            self.conf.root.a.c = 4

    def test__getting_through_getitem(self):
        self.assertIsInstance(self.conf['a'], Config)

    def test__contains(self):
        self.assertTrue("a" in self.conf)
        self.assertFalse("b" in self.conf)
        self.assertFalse("c" in self.conf["a"])
        self.assertTrue("b" in self.conf["a"])

    def test__item_not_found(self):
        with self.assertRaises(LookupError):
            self.conf.root.a.c

    def test__keys(self):
        self.assertEquals(set(self.conf.keys()), set(['a']))
Example #2
0
 def setUp(self):
     super(BasicUsageTest, self).setUp()
     self.conf = Config(dict(
         a=dict(
             b=2
         )
     ))
Example #3
0
 def setUp(self):
     super(SerializationTest, self).setUp()
     self.dict = dict(
         a=dict(
             b=dict(
                 c=8
             )
         )
     )
     self.conf = Config(self.dict)
Example #4
0
 def setUp(self):
     super(HelperMethodsTest, self).setUp()
     self.config = Config({
         "a": {
             "b": 2,
             "c": {
                 "d": 3,
             },
             "e": 4,
         },
         "f": 5,
     })
Example #5
0
class BackupTest(TestCase):

    def setUp(self):
        super(BackupTest, self).setUp()
        self.conf = Config(dict(a=1, b=2))

    def test__restore_no_backup(self):
        with self.assertRaises(exceptions.NoBackup):
            self.conf.restore()

    def test__discard(self):
        self.conf.backup()
        self.conf.discard_backup()
        with self.assertRaises(exceptions.NoBackup):
            self.conf.restore()
Example #6
0
class SerializationTest(TestCase):

    def setUp(self):
        super(SerializationTest, self).setUp()
        self.dict = dict(
            a=dict(
                b=dict(
                    c=8
                )
            )
        )
        self.conf = Config(self.dict)

    def test__serialization(self):
        result = self.conf.serialize_to_dict()
        self.assertIsNot(result, self.dict)
        self.assertEquals(result, self.dict)
        self.assertIsNot(result['a'], self.dict['a'])
        self.assertEquals(result['a']['b']['c'], 8)

    def test__serialization_with_assignment(self):
        self.conf.assign_path("a.b.c", 9)
        result = self.conf.serialize_to_dict()
        self.assertEquals(result['a']['b']['c'], 9)
Example #7
0
 def setUp(self):
     super(ArgumentParsingTest, self).setUp()
     self.config = Config({
         "a": {
             "a1": {
                 "flag1": True // conf_utils.Cmdline(off="--no-flag1")
             }
         },
         "b": {
             "b1": {
                 "flag2": False // conf_utils.Cmdline(on="--flag2")
             }
         },
         "string_value": "",
         "int_value": 0,
     })
Example #8
0
class HelperMethodsTest(TestCase):

    def setUp(self):
        super(HelperMethodsTest, self).setUp()
        self.config = Config({
            "a": {
                "b": 2,
                "c": {
                    "d": 3,
                },
                "e": 4,
            },
            "f": 5,
        })

    def test__traverse_leaves(self):
        self.assertEquals(
            sorted((path, c.get_value())
                   for path, c in self.config.traverse_leaves()),
            [("a.b", 2), ("a.c.d", 3), ("a.e", 4), ("f", 5)])
Example #9
0
 def setUp(self):
     super(ArgumentParsingTest, self).setUp()
     self.config = Config({
         "a": {
             "a1": {
                 "flag1": True // conf_utils.Cmdline(off="--no-flag1")
             }
         },
         "b": {
             "b1": {
                 "flag2": False // conf_utils.Cmdline(on="--flag2")
             }
         },
         "string_value":
         "",
         "int_value":
         0 //
         conf_utils.Cmdline(increase="--increase", decrease="--decrease"),
         "arg_value":
         "" // conf_utils.Cmdline(arg="--arg-value"),
         "list": ["existing_item"] // conf_utils.Cmdline(append="--append"),
     })
Example #10
0
class ExtendingTest(TestCase):

    def setUp(self):
        super(ExtendingTest, self).setUp()
        self.conf = Config({
            "a": 1
        })

    def test__extend_single_value(self):
        self.conf.extend({"b": 2})
        self.assertEquals(self.conf.root.b, 2)

    def test__extend_keyword_arguments(self):
        self.conf.extend(b=2)
        self.assertEquals(self.conf.root.b, 2)

    def test__extend_structure(self):
        self.conf.extend({
            "b": {
                "c": {
                    "d": 2
                }
            }
        })
        self.assertEquals(self.conf.root.b.c.d, 2)

    def test__extend_structure_and_keywords(self):
        self.conf.extend({"b":1, "c":3}, b=2)
        self.assertEquals(self.conf.root.b, 2)
        self.assertEquals(self.conf.root.c, 3)

    def test__extend_preserves_nodes(self):
        self.conf.extend({"b": {"c": 2}})
        self.conf.extend({"b": {"d": 3}})
        self.assertEquals(
            self.conf.serialize_to_dict(),
            {"a": 1, "b": {"c": 2, "d": 3}}
        )

    def test__extend_config(self):
        self.conf.extend(Config({
            "b": {
                "c": {
                    "d": 2
                }
            }
        }))
        self.assertEquals(self.conf.root.b.c.d, 2)

    def test__extend_config_propagates_changes(self):
        new_cfg = Config({'b': {'c': 2}})
        self.conf.extend(new_cfg)
        self.assertEquals(self.conf.root.b.c, 2)
        new_cfg.root.b.c = 3
        self.assertEquals(self.conf.root.b.c, 3)

    def test__extend_config_preserves_metadata(self):
        new_cfg = Config({'b': {'c': 2 // Metadata(x=3)}})
        self.conf.extend(new_cfg)
        self.assertEquals(self.conf.get_config('b.c').metadata, {'x': 3})

    def test__extend_config_preserves_nodes(self):
        self.conf.extend(Config({"b": {"c": 2}}))
        self.conf.extend(Config({"b": {"c": 2, "d": 3}}))
        self.assertEquals(
            self.conf.serialize_to_dict(),
            {"a": 1, "b": {"c": 2, "d": 3}}
        )

    def test__extend_config_prevents_losing_path(self):
        self.conf.extend(Config({"b": {"c": 2}}))
        with self.assertRaises(exceptions.CannotSetValue):
            self.conf.extend(Config({"b": {"d": 3}}))

    def test__update_config_preserves_nodes(self):
        self.conf.update(Config({"b": {"c": 2}}))
        self.conf.update(Config({"b": {"d": 3}}))
        self.assertEquals(
            self.conf.serialize_to_dict(),
            {"a": 1, "b": {"c": 2, "d": 3}}
        )
Example #11
0
class PathAssignmentTest(TestCase):

    def setUp(self):
        super(PathAssignmentTest, self).setUp()
        self.conf = Config(dict(a=dict(b=dict(c=3)), d=4, e=None))

    def tearDown(self):
        super(PathAssignmentTest, self).tearDown()

    def test_invalid_path_assignment_to_path(self):
        with self.assertRaises(exceptions.InvalidPath):
            self.conf.assign_path("a.g.d", 3)

    def test_invalid_path_getting(self):
        with self.assertRaises(exceptions.InvalidPath):
            self.conf.get_path("a.g.d")

    def test_get_path_direct(self):
        self.assertEquals(4, self.conf.get_path("d"))

    def test_path_deducing_with_none(self):
        self.conf.root.a.b.c = None
        self.assertIsNone(self.conf.root.a.b.c)
        with self.assertRaises(exceptions.CannotDeduceType):
            self.conf.assign_path_expression('a.b.c=2', deduce_type=True)
        self.assertIsNone(self.conf.root.a.b.c)

    def test_path_assign_value_deduce_type(self):
        self.conf.root.a.b.c = 1
        self.conf.assign_path('a.b.c', '2', deduce_type=True)
        self.assertEquals(self.conf.root.a.b.c, 2)

    def test_path_deducing_with_none_force_type(self):
        self.conf.assign_path_expression(
            "a.b.c=2", deduce_type=True, default_type=str)
        self.assertEquals(self.conf.root.a.b.c, 2)

    def test_path_deducing_with_compound_types(self):
        for initial_value, value in [
                ([1, 2, 3], ["a", "b", 3]),
                ((1, 2), (3, 4, 5))
        ]:
            self.conf["a"]["b"] = initial_value
            self.conf.assign_path_expression(
                "a.b={0!r}".format(value), deduce_type=True)
            self.assertEquals(self.conf["a"]["b"], value)

    def test_path_deducing_with_booleans(self):
        for false_literal in ('false', 'False', 'no', 'n', 'No', 'N'):
            self.conf['a']['b']['c'] = True
            self.conf.assign_path_expression(
                'a.b.c={0}'.format(false_literal), deduce_type=True)
            self.assertFalse(self.conf.root.a.b.c)
        for true_literal in ('true', 'True', 'yes', 'y', 'Yes', 'Y'):
            self.conf['a']['b']['c'] = False
            self.conf.assign_path_expression(
                'a.b.c={0}'.format(true_literal), deduce_type=True)
            self.assertTrue(self.conf.root.a.b.c)
        for invalid_literal in ('trueee', 0, 23, 2.3):
            with self.assertRaises(ValueError):
                self.conf.assign_path_expression(
                    'a.b.c={0}'.format(invalid_literal), deduce_type=True)

    def test_assign_path_direct(self):
        self.conf.assign_path('d', 5)
        self.assertEquals(self.conf['d'], 5)
Example #12
0
 def setUp(self):
     super(BackupTest, self).setUp()
     self.conf = Config(dict(a=1, b=2))
Example #13
0
 def setUp(self):
     super(LinkedConfigurationTest, self).setUp()
     self.conf1 = Config(dict(a=1))
     self.conf2 = Config(dict(c=2))
     self.conf1.extend({"b": self.conf2})
Example #14
0
from confetti import Config
import os

app_path=os.path.dirname(os.path.abspath(__file__))

options = dict(
    app_path=app_path,
    reports_dir=os.path.join(app_path,"reports"),
    debug=True
)

config = Config()
config.extend(options)
Example #15
0
 def setUp(self):
     super(PathAssignmentTest, self).setUp()
     self.conf = Config(dict(a=dict(b=dict(c=3)), d=4, e=None))
Example #16
0
config = Config({
    "debug": {
        "enabled":
        False // Doc("Enter pdb on failures and errors") //
        Cmdline(on="--pdb"),
    },
    "log": {
        "console_level":
        logbook.WARNING // Cmdline(decrease="-v", increase="-q"),
        "root":
        None // Doc("Root directory for logs") // Cmdline(arg="-l"),
        "subpath":
        "{context.session.id}/{context.test_id}/log" //
        Doc("Path to write logs to under the root"),
        "session_subpath":
        "session.log",
    },
    "run": {
        "stop_on_error":
        False // Doc("Stop execution when a test doesn't succeed") //
        Cmdline(on="-x"),
    },
    "notifications": {
        "prowl_api_key": None,
        "nma_api_key": None,
    },
    "sentry": {
        "dsn":
        None //
        Doc("Possible DSN for a sentry service to log swallowed exceptions. "
            "See http://getsentry.com for details"),
    },
    "hooks": {
        "swallow_exceptions":
        False // Doc("If set, exceptions inside hooks will be re-raised"),
    },
    "plugins": {
        "search_paths":
        [] // Doc("List of paths in which to search for plugin modules"),
    },
})
Example #17
0
 def setUp(self):
     super(BackupTest, self).setUp()
     self.conf = Config(dict(a=1, b=2, c=[]))
     self.conf.extend(Config({'d': []}))
Example #18
0
class BackupTest(TestCase):

    def setUp(self):
        super(BackupTest, self).setUp()
        self.conf = Config(dict(a=1, b=2, c=[]))
        self.conf.extend(Config({'d': []}))

    def test_backup_context(self):
        with self.conf.backup_context():
            self.conf.root.a = 10
            assert self.conf.root.a == 10

        assert self.conf.root.a == 1

    def test_restore_no_backup(self):
        with self.assertRaises(exceptions.NoBackup):
            self.conf.restore()

    def test_discard(self):
        self.conf.backup()
        self.conf.discard_backup()
        with self.assertRaises(exceptions.NoBackup):
            self.conf.restore()

    def test_backup_copy(self):
        self.conf.backup()
        self.conf.root.c.append(0)
        self.conf.root.d.extend([2, 3])
        self.conf.restore()
        self.assertEqual(self.conf.root.c, [])
        self.assertEqual(self.conf.root.d, [])
Example #19
0
config = Config({
    "debug": {
        "debug_skips":
        False // Doc("Enter pdb also for SkipTest exceptions"),
        "debug_hook_handlers":
        False //
        Doc("Enter pdb also for every exception encountered in a hook/callback. Only relevant when debugging is enabled"
            ),
        "enabled":
        False // Doc("Enter pdb on failures and errors") //
        Cmdline(on="--pdb"),
    },
    "log": {
        "colorize":
        False // Doc("Emit log colors to files"),
        "console_theme": {
            'inline-file-end-fail': 'red',
            'inline-file-end-skip': 'yellow',
            'inline-file-end-success': 'green',
            'inline-error': 'red',
            'inline-test-interrupted': 'yellow',
            'error-cause-marker': 'white/bold',
            'fancy-message': 'yellow/bold',
            'frame-local-varname': 'yellow/bold',
            'session-summary-success': 'green/bold',
            'session-summary-failure': 'red/bold',
            'error-separator-dash': 'red',
            'tb-error': 'red/bold',
            'tb-frame-location': 'white/bold',
            'test-additional-details-header': 'black/bold',
            'test-additional-details': 'black/bold',
            'test-error-header': 'white',
            'test-skip-message': 'yellow',
            'tb-line-cause': 'white',
            'tb-test-line': 'red/bold',
            'tb-line': 'black/bold',
        },
        "console_level":
        logbook.WARNING //
        Cmdline(decrease='-v',
                decrease_doc=
                'Make console more verbose (can be specified multiple times)',
                increase='-q',
                increase_doc=
                'Make console less verbose (can be specified multiple times)'),
        "traceback_level":
        2 // Doc("Detail level of tracebacks") // Cmdline(arg="--tb"),
        "truncate_console_lines":
        True // Doc("truncate long log lines on the console") //
        Cmdline(arg='--truncate-console-lines', metavar='yes/no'),
        "truncate_console_errors":
        False //
        Doc("If truncate_console_lines is set, also truncate long log lines, including and above the \"error\" level, on the console"
            ),
        "root":
        None // Doc("Root directory for logs") //
        Cmdline(arg="-l", metavar="DIR"),
        "subpath":
        "{context.session.id}/{context.test_id}/debug.log" //
        Doc("Path to write logs to under the root"),
        "session_subpath":
        "{context.session.id}/session.log",
        "last_session_symlink":
        None //
        Doc("If set, specifies a symlink path to the last session log file in each run"
            ),
        "last_session_dir_symlink":
        None //
        Doc("If set, specifies a symlink path to the last session log directory"
            ),
        "last_test_symlink":
        None //
        Doc("If set, specifies a symlink path to the last test log file in each run"
            ),
        "last_failed_symlink":
        None //
        Doc("If set, specifies a symlink path to the last failed test log file"
            ),
        "show_manual_errors_tb":
        True // Doc("Show tracebacks for errors added via slash.add_error"),
        "silence_loggers": [] // Doc("Logger names to silence"),
        "format":
        None //
        Doc("Format of the log line, as passed on to logbook. None will use the default format"
            ),
        "console_format":
        None //
        Doc("Optional format to be used for console output. Defaults to the regular format"
            ),
        "localtime":
        False // Doc("Use local time for logging. If False, will use UTC"),
        "unittest_mode":
        False //
        Doc("Used during unit testing. Emit all logs to stderr as well as the log files"
            ),
        "unified_session_log":
        False //
        Doc("Make the session log file contain all logs, including from tests"
            ),
    },
    "run": {
        "dump_variation":
        False //
        Doc("Output the full variation structure before each test is run (mainly used for internal debugging)"
            ),
        "default_sources": [] //
        Doc("Default tests to run assuming no other sources are given to the runner"
            ),
        "suite_files":
        [] // Doc("File(s) to be read for lists of tests to be run") //
        Cmdline(append="-f", metavar="FILENAME"),
        "stop_on_error":
        False // Doc("Stop execution when a test doesn't succeed") //
        Cmdline(on="-x"),
        "filter_strings": [] //
        Doc("A string filter, selecting specific tests by string matching against their name"
            ) // Cmdline(append='-k', metavar='FILTER'),
        "repeat_each":
        1 // Doc("Repeat each test a specified amount of times") //
        Cmdline(arg='--repeat-each', metavar="NUM_TIMES"),
        "repeat_all":
        1 // Doc("Repeat all suite a specified amount of times") //
        Cmdline(arg='--repeat-all', metavar="NUM_TIMES"),
        "session_state_path":
        "~/.slash/last_session" //
        Doc("Where to keep last session serialized data"),
        "project_customization_file_path":
        "./.slashrc",
        "user_customization_file_path":
        "~/.slash/slashrc",
    },
    "sentry": {
        "dsn":
        None //
        Doc("Possible DSN for a sentry service to log swallowed exceptions. "
            "See http://getsentry.com for details"),
    },
    "plugins": {
        "search_paths":
        [] // Doc("List of paths in which to search for plugin modules"),
    },
    "plugin_config": {
        # DO NOT store configuration here. It is intended for dynamically loaded plugins
    },
})
Example #20
0
 def setUp(self):
     super(ExtendingTest, self).setUp()
     self.conf = Config({
         "a": 1
     })
Example #21
0
class LinkedConfigurationTest(TestCase):

    def setUp(self):
        super(LinkedConfigurationTest, self).setUp()
        self.conf1 = Config(dict(a=1))
        self.conf2 = Config(dict(c=2))
        self.conf1.extend({"b": self.conf2})

    def test__linked_configurations(self):
        self.assertIs(self.conf1['b'], self.conf2)

    def test__linked_backup_and_restore(self):
        self.conf1.backup()
        self.conf2['c'] = 3
        self.assertEquals(self.conf1.root.b.c, 3)
        self.conf1['a'] = 2
        self.conf1.restore()
        self.assertEquals(self.conf1.root.b.c, 2)

    def test__linked_backups_restore_parent_then_child(self):
        self.conf2.backup()
        self.conf1.backup()
        self.conf2['c'] = 4
        self.assertEquals(self.conf2.root.c, 4)
        self.conf1.restore()
        self.assertEquals(self.conf2.root.c, 2)
        self.conf2['c'] = 5
        self.assertEquals(self.conf2.root.c, 5)
        self.conf2.restore()
        self.assertEquals(self.conf2.root.c, 2)
Example #22
0
from confetti import Config
import json
import os

_existing_config = os.environ.get('TESTBED_CONFIG_PATH')
if _existing_config is not None:
    with open(existing_config) as f:
        cfg = Config(json.load(f))
else:
    cfg = Config({
        'backslash_url': None,
    })

root = cfg.root


def serialize():
    return cfg.serialize_to_dict()
Example #23
0
config = Config({
    "debug": {
        "debug_skips": False // Doc("Enter pdb also for SkipTest exceptions"),
        "debug_hook_handlers": False // Doc("Enter pdb also for every exception encountered in a hook/callback. Only relevant when debugging is enabled"),
        "enabled": False // Doc("Enter pdb on failures and errors") // Cmdline(on="--pdb"),
        "filter_strings": [] // Doc("A string filter, selecting if to enter pdb") // Cmdline(append='--pdb-filter',
                                                                                             metavar='FILTER'),
        "debugger": None,
    },

    "log": {
        "colorize": False // Doc("Emit log colors to files"),
        "console_theme": {
            'dark_background': True,
            'inline-file-end-fail': 'red',
            'inline-file-end-skip': 'yellow',
            'inline-file-end-success': 'green',
            'inline-error': 'red',
            'inline-test-interrupted': 'yellow',
            'error-cause-marker': 'white/bold',
            'fancy-message': 'yellow/bold',
            'frame-local-varname': 'yellow/bold',
            'num-collected': 'white/bold',
            'session-summary-success': 'green/bold',
            'session-summary-failure': 'red/bold',
            'session-start': 'white/bold',
            'error-separator-dash': 'red',
            'tb-error-message': 'red/bold',
            'tb-error': 'red/bold',
            'tb-frame-location': 'white/bold',
            'test-additional-details-header': 'black/bold',
            'test-additional-details': 'black/bold',
            'test-error-header': 'white',
            'test-skip-message': 'yellow',
            'tb-line-cause': 'white',
            'tb-test-line': 'red/bold',
            'tb-line': 'black/bold',
        },

        "console_level": logbook.WARNING // Cmdline(decrease='-v',
                                                    decrease_doc='Make console more verbose (can be specified multiple times)',
                                                    increase='-q',
                                                    increase_doc='Make console less verbose (can be specified multiple times)'),
        "core_log_level": logbook.WARNING // Doc("Minimal level of slash log messages to show"),
        "color_console": None // Cmdline(on='--force-color', off='--no-color'),
        "repr_blacklisted_types": [] // Doc("Blacklisted types that should not be repred in traceback"),
        "traceback_variables": False // Doc("Logs values of variables in traceback frames for added errors"),
        "console_traceback_level": 2 // Doc("Detail level of tracebacks") // Cmdline(arg="--tb"),
        "truncate_console_lines": True // Doc("truncate long log lines on the console") // Cmdline(arg='--truncate-console-lines', metavar='yes/no'),
        "truncate_console_errors": False // Doc("If truncate_console_lines is set, also truncate long log lines, including and above the \"error\" level, on the console"),
        "root": None // Doc("Root directory for logs") // Cmdline(arg="-l", metavar="DIR"),
        "subpath": "{context.session.id}/{context.test_id}/debug.log" // Doc("Path to write logs to under the root"),
        "session_subpath": "{context.session.id}/session.log",
        "highlights_subpath": None // Doc("If set, this path will be used to record highlights (eg. errors added) in the session and/or tests"),
        "last_session_symlink": None // Doc("If set, specifies a symlink path to the last session log file in each run"),
        "last_session_dir_symlink": None // Doc("If set, specifies a symlink path to the last session log directory"),
        "last_test_symlink": None // Doc("If set, specifies a symlink path to the last test log file in each run"),
        "last_failed_symlink": None // Doc("If set, specifies a symlink path to the last failed test log file"),
        "show_manual_errors_tb": True // Doc("Show tracebacks for errors added via slash.add_error"),
        "show_raw_param_values": False // Doc("Makes test start logs contain the raw values of test parameters"),

        "silence_loggers": [] // Doc("Logger names to silence"),
        "format": None // Doc("Format of the log line, as passed on to logbook. None will use the default format"),
        "console_format": None // Doc("Optional format to be used for console output. Defaults to the regular format"),
        "localtime": False // Doc("Use local time for logging. If False, will use UTC"),
        "unittest_mode": False // Doc("Used during unit testing. Emit all logs to stderr as well as the log files"),
        "unified_session_log": False // Doc("Make the session log file contain all logs, including from tests"),
        "compression": {
            "enabled": False // Doc("Compress log files"),
            "algorithm": "brotli" // Doc("Compression algorithm to use, either gzip or brotli"),
            "use_rotating_raw_file": False // Doc("When compression is enabled, write also to uncompressed rotating log file"),
        },
        "cleanup": {
            "enabled": False,
            "keep_failed": True,
        }
    },
    "run": {
        "dump_variation": False // Doc("Output the full variation structure before each test is run (mainly used for internal debugging)"),
        "default_sources": [] // Doc("Default tests to run assuming no other sources are given to the runner"),
        "suite_files": [] // Doc("File(s) to be read for lists of tests to be run") // Cmdline(append="-f", metavar="FILENAME"),
        "stop_on_error": False // Doc("Stop execution when a test doesn't succeed") // Cmdline(on="-x", off="-X"),
        "filter_strings": [] // Doc("A string filter, selecting specific tests by string matching against their name") // Cmdline(append='-k', metavar='FILTER'),
        "repeat_each": 1 // Doc("Repeat each test a specified amount of times") // Cmdline(arg='--repeat-each', metavar="NUM_TIMES"),
        "repeat_all": 1 // Doc("Repeat all suite a specified amount of times") // Cmdline(arg='--repeat-all', metavar="NUM_TIMES"),
        "session_state_path": "~/.slash/last_session" // Doc("Where to keep last session serialized data"),
        "project_name": None,
        "project_customization_file_path": "./.slashrc",
        "user_customization_file_path": "~/.slash/slashrc",
        "resume_state_path": "~/.slash/session_states" // Doc("Path to store or load session's resume data"),
        "message_assertion_introspection": True // Doc("When False, failing assertions which have messages attached will not emit introspection info"),
        "capture": {
            "error_logs_as_errors": False // Doc("Add errors for error level logs"),
        },
    },
    "interactive": {
        "expose_g_globals": True // Doc("When False, slash.g won't be added to interactive test namespaces"),
        "colors": None // Doc("IPython color scheme"),
    },

    "parallel": {
        "num_workers": 0 // Doc("Parallel execution") // Cmdline(arg='--parallel', metavar="NUM_WORKERS"),
        "worker_id": None // Doc("Worker_id") // Cmdline(arg='--parallel-worker-id', metavar="WORKER_ID"),
        "server_addr": "localhost" // Doc("Server address") // Cmdline(arg='--parallel-addr', metavar="PARALLEL_SERVER_ADDRESS"),
        "server_port": 0 // Doc("Server port") // Cmdline(arg='--parallel-port', metavar="PARALLEL_SERVER_PORT"),
        "keepalive_port": 0 // Doc("Keepalive port") // Cmdline(arg='--keepalive-port', metavar="KEEPALIVE_SERVER_PORT"),
        "parent_session_id": None // Doc("parent session id") // Cmdline(arg='--parallel-parent-session-id', metavar="MASTER_SESSION_ID"),
        "communication_timeout_secs": 60 // Doc("timeout of worker in seconds"),
        "worker_connect_timeout": 10 // Doc("timeout for each worker to connect"),
        "no_request_timeout": 20 // Doc("timeout for server not getting requests"),
        "worker_error_file": "errors-worker" // Doc("worker error filename template"),
        "workers_error_dir": None // Doc("workers error directory") // Cmdline(arg='--workers-error-dir', metavar="WORKERS_ERROR_DIR"),
    },
    "resume": {
        "failed_first": False // Doc("Run failed tests of previous session before all others") // Cmdline(on='--failed-first', metavar="FAILED_FIRST"),
        "unstarted_first": False // Doc("Run unstarted tests of previous session before all others") // Cmdline(on='--unstarted-first', metavar="UNSTARTED_FIRST"),
        "failed_only": False // Doc("Run only failed tests of previous session") // Cmdline(on='--failed-only', metavar="FAILED_ONLY"),
        "unstarted_only": False // Doc("Run only unstarted tests of previous session") // Cmdline(on='--unstarted-only', metavar="UNSTARTED_ONLY"),
        "state_retention_days": 10 // Doc("Number of days to keep session entries for resuming session")
    },
    "tmux": {
        "enabled": False // Doc("Run inside tmux") // Cmdline(on="--tmux"),
        "use_panes": False // Doc("In parallel mode, run children inside panes and not windows") // Cmdline(on="--tmux-panes"),
    },
    "sentry": {
        "dsn": None // Doc("Possible DSN for a sentry service to log swallowed exceptions. "
                           "See http://getsentry.com for details"),
    },
    "plugins": {
        "search_paths": [] // Doc("List of paths in which to search for plugin modules"),
    },

    "plugin_config": {
        # DO NOT store configuration here. It is intended for dynamically loaded plugins
    },
})
Example #24
0
from confetti import Config
from slash.utils.conf_utils import Doc

__all__ = ["config"]

config = Config({
    'treerunner': {
        'ip': '10.2.0.6' // Doc("Treerunner target IP address"),
        'username': '******' // Doc("Sync target SSH user name"),
        'password': '******',
    },
    'serial_port': {
        'port': None,
        'baudrate': '115200'
    }
})