API Reference¶
This section contains the complete API reference for the baygon package.
It is generated automatically from the source code using mkdocstrings
and reflects the latest docstrings available in the project.
baygon ¶
Baygon public API.
Classes¶
CaseModel
dataclass
¶
Leaf test case definition.
Source code in baygon/core/models.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
ConditionModel
dataclass
¶
Matcher configuration applied to stdout/stderr.
Source code in baygon/core/models.py
40 41 42 43 44 45 46 47 48 49 50 51 52 | |
ExecutionResult
dataclass
¶
Lightweight execution summary for downstream reporting.
Source code in baygon/core/models.py
142 143 144 145 146 147 148 149 150 | |
GroupModel
dataclass
¶
Hierarchical test group definition.
Source code in baygon/core/models.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
Functions¶
iter_cases ¶
iter_cases()
Iterate over every leaf case contained in this group.
Source code in baygon/core/models.py
103 104 105 106 107 108 109 | |
NegatedConditionModel
dataclass
¶
Single negated matcher condition.
Source code in baygon/core/models.py
31 32 33 34 35 36 37 | |
SuiteModel
dataclass
¶
Top-level immutable suite description.
Source code in baygon/core/models.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
Functions¶
iter_cases ¶
iter_cases()
Iterate over every test case in the suite.
Source code in baygon/core/models.py
133 134 135 136 137 138 139 | |
Executable ¶
An executable program.
Convenient execution and access to program outputs such as:
- Exit status
- Standard output
- Standard error
For example:
>>> e = Executable("echo")
>>> e
Executable<echo>
>>> e("-n", "Hello World")
Outputs(exit_status=0, stdout='Hello World', stderr='')
>>> e("-n", "Hello World").stdout
'Hello World'
Source code in baygon/executable.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
Functions¶
run ¶
run(*args, stdin=None, env=None, hook=None)
Run the program and grab all the outputs.
Source code in baygon/executable.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
BaygonRunner ¶
Execute suites described by immutable models.
Source code in baygon/runtime/runner.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
Attributes¶
Functions¶
run ¶
run(limit=-1)
Run the test suite.
Source code in baygon/runtime/runner.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
CaseResult
dataclass
¶
Individual case execution result.
Source code in baygon/runtime/runner.py
30 31 32 33 34 35 36 37 38 39 | |
CommandLog
dataclass
¶
Captured information about a single executed command.
Source code in baygon/runtime/runner.py
19 20 21 22 23 24 25 26 27 | |
RunReport
dataclass
¶
Aggregated information after running a suite.
Source code in baygon/runtime/runner.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
SuiteContext
dataclass
¶
Immutable bundle describing a suite ready to be executed.
Source code in baygon/suite.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
Functions¶
create_runner ¶
create_runner(
*, executable=None, runner_factory=BaygonRunner
)
Return a runner configured for this suite.
Source code in baygon/suite.py
53 54 55 56 57 58 59 60 61 62 63 64 | |
SuiteExecutor ¶
Execute suites described by SuiteContext.
Source code in baygon/suite.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
Functions¶
run ¶
run(context, *, executable=None, limit=-1)
Run the suite described by the provided context.
Source code in baygon/suite.py
158 159 160 161 162 163 164 165 166 167 168 169 170 | |
SuiteLoader ¶
Load suite configurations from files or raw mappings.
Source code in baygon/suite.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
Functions¶
from_mapping ¶
from_mapping(data, *, cwd=None)
Validate a raw mapping and build its execution context.
Source code in baygon/suite.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
from_path ¶
from_path(path)
Load configuration from disk and build its execution context.
Source code in baygon/suite.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
load ¶
load(*, data=None, path=None, cwd=None)
Load a suite configuration from a mapping or a path.
Source code in baygon/suite.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
SuiteService ¶
Facade coordinating loading and execution of Baygon suites.
Source code in baygon/suite.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
Functions¶
load ¶
load(*, data=None, path=None, cwd=None)
Return a validated suite context without running it.
Source code in baygon/suite.py
184 185 186 187 188 189 190 191 192 | |
run ¶
run(
*,
data=None,
path=None,
cwd=None,
executable=None,
limit=-1
)
Load and execute a suite in one call.
Source code in baygon/suite.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
Functions¶
discover_config ¶
discover_config(path)
Locate a configuration file starting from the given path or CWD.
Source code in baygon/config/loader.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
load_config ¶
load_config(path)
Load a configuration file and build a SuiteModel.
Source code in baygon/config/loader.py
39 40 41 42 43 | |
load_config_dict ¶
load_config_dict(path)
Load a configuration file and return the validated dictionary form.
Source code in baygon/config/loader.py
46 47 48 49 50 51 | |
build_suite_model ¶
build_suite_model(config)
Build an immutable SuiteModel from validated schema data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Mapping[str, Any]
|
Mapping returned by |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SuiteModel |
SuiteModel
|
frozen domain representation suitable as a SSOT. |
Source code in baygon/core/models.py
153 154 155 156 157 158 159 160 161 162 163 164 | |
Schema ¶
Schema(data, humanize=False)
Validate the given data against the Baygon schema.
Source code in baygon/schema.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | |
Modules¶
config ¶
Configuration loading utilities.
Functions¶
discover_config ¶
discover_config(path)
Locate a configuration file starting from the given path or CWD.
Source code in baygon/config/loader.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
load_config ¶
load_config(path)
Load a configuration file and build a SuiteModel.
Source code in baygon/config/loader.py
39 40 41 42 43 | |
load_config_dict ¶
load_config_dict(path)
Load a configuration file and return the validated dictionary form.
Source code in baygon/config/loader.py
46 47 48 49 50 51 | |
Modules¶
loader ¶
Load Baygon configuration files and return immutable suite models.
discover_config(path)
Locate a configuration file starting from the given path or CWD.
Source code in baygon/config/loader.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
load_config(path)
Load a configuration file and build a SuiteModel.
Source code in baygon/config/loader.py
39 40 41 42 43 | |
load_config_dict(path)
Load a configuration file and return the validated dictionary form.
Source code in baygon/config/loader.py
46 47 48 49 50 51 | |
core ¶
Domain-layer models exposed by Baygon.
Classes¶
CaseModel
dataclass
¶
Leaf test case definition.
Source code in baygon/core/models.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
ConditionModel
dataclass
¶
Matcher configuration applied to stdout/stderr.
Source code in baygon/core/models.py
40 41 42 43 44 45 46 47 48 49 50 51 52 | |
ExecutionResult
dataclass
¶
Lightweight execution summary for downstream reporting.
Source code in baygon/core/models.py
142 143 144 145 146 147 148 149 150 | |
GroupModel
dataclass
¶
Hierarchical test group definition.
Source code in baygon/core/models.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
iter_cases()
Iterate over every leaf case contained in this group.
Source code in baygon/core/models.py
103 104 105 106 107 108 109 | |
NegatedConditionModel
dataclass
¶
Single negated matcher condition.
Source code in baygon/core/models.py
31 32 33 34 35 36 37 | |
SuiteModel
dataclass
¶
Top-level immutable suite description.
Source code in baygon/core/models.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
iter_cases()
Iterate over every test case in the suite.
Source code in baygon/core/models.py
133 134 135 136 137 138 139 | |
Functions¶
build_suite_model ¶
build_suite_model(config)
Build an immutable SuiteModel from validated schema data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Mapping[str, Any]
|
Mapping returned by |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SuiteModel |
SuiteModel
|
frozen domain representation suitable as a SSOT. |
Source code in baygon/core/models.py
153 154 155 156 157 158 159 160 161 162 163 164 | |
Modules¶
models ¶
Immutable domain models for Baygon configurations and execution state.
dataclass
¶Single negated matcher condition.
Source code in baygon/core/models.py
31 32 33 34 35 36 37 | |
dataclass
¶Matcher configuration applied to stdout/stderr.
Source code in baygon/core/models.py
40 41 42 43 44 45 46 47 48 49 50 51 52 | |
dataclass
¶Leaf test case definition.
Source code in baygon/core/models.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
dataclass
¶Hierarchical test group definition.
Source code in baygon/core/models.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
iter_cases()
Iterate over every leaf case contained in this group.
Source code in baygon/core/models.py
103 104 105 106 107 108 109 | |
dataclass
¶Top-level immutable suite description.
Source code in baygon/core/models.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
iter_cases()
Iterate over every test case in the suite.
Source code in baygon/core/models.py
133 134 135 136 137 138 139 | |
dataclass
¶Lightweight execution summary for downstream reporting.
Source code in baygon/core/models.py
142 143 144 145 146 147 148 149 150 | |
build_suite_model(config)
Build an immutable SuiteModel from validated schema data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Mapping[str, Any]
|
Mapping returned by |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SuiteModel |
SuiteModel
|
frozen domain representation suitable as a SSOT. |
Source code in baygon/core/models.py
153 154 155 156 157 158 159 160 161 162 163 164 | |
error ¶
Errors for Baygon
Classes¶
BaygonError ¶
Bases: Exception
Base class for Baygon errors
Source code in baygon/error.py
6 7 | |
ConfigError ¶
Bases: BaygonError
Raised when a config value is not valid
Source code in baygon/error.py
10 11 | |
InvalidExecutableError ¶
Bases: BaygonError
Raised when an executable is not found
Source code in baygon/error.py
14 15 | |
InvalidFilterError ¶
Bases: BaygonError
Raised when a filter is not found
Source code in baygon/error.py
18 19 | |
ConfigSyntaxError ¶
Bases: ConfigError
Raised when the configuration file cannot be parsed.
Source code in baygon/error.py
22 23 24 25 26 27 28 29 30 31 32 | |
eval ¶
Helper functions used in eval filter.
These functions are injected into the kernel and made available from
the mustaches templates.
Examples:
>>> reset()
>>> iter()
0
>>> iter()
1
>>> iter()
2
>>> iter(100, 10)
100
>>> iter(100, 10)
110
>>> iter(ctx="foo")
0
>>> iter(ctx="foo")
1
>>> reset()
>>> iter()
0
>>> iter(100, 10)
100
Functions¶
reset ¶
reset()
Reset the context.
Source code in baygon/eval.py
31 32 33 | |
iter ¶
iter(start=0, step=1, ctx=None)
Custom iterator for eval input filter.
Source code in baygon/eval.py
36 37 38 39 40 | |
executable ¶
Executable class. To be used with the Test class.
Classes¶
Executable ¶
An executable program.
Convenient execution and access to program outputs such as:
- Exit status
- Standard output
- Standard error
For example:
>>> e = Executable("echo")
>>> e
Executable<echo>
>>> e("-n", "Hello World")
Outputs(exit_status=0, stdout='Hello World', stderr='')
>>> e("-n", "Hello World").stdout
'Hello World'
Source code in baygon/executable.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
run(*args, stdin=None, env=None, hook=None)
Run the program and grab all the outputs.
Source code in baygon/executable.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
Functions¶
get_env ¶
get_env(env=None)
Get the environment variables to be used for the subprocess.
Source code in baygon/executable.py
20 21 22 | |
filters ¶
String filters for Baygon.
Each filter is a class that implements a filter method.
A filter is used to modify stdout and stderr before they are tested.
Classes¶
Filter ¶
Bases: ABC
Base class for filters.
Source code in baygon/filters.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
abstractmethod
¶apply(value)
Apply the filter to a value.
Source code in baygon/filters.py
23 24 25 26 | |
filter(value)
Apply the filter to a value.
Source code in baygon/filters.py
28 29 30 | |
classmethod
¶name()
Return the name of the filter.
Source code in baygon/filters.py
47 48 49 50 | |
FilterNone ¶
Bases: Filter
Filter that does nothing.
Source code in baygon/filters.py
90 91 92 93 94 95 | |
FilterUppercase ¶
Bases: Filter
Filter for uppercase strings.
f = FilterUppercase() f("hello") 'HELLO'
Source code in baygon/filters.py
98 99 100 101 102 103 104 105 106 107 | |
FilterLowercase ¶
Bases: Filter
Filter for lowercase strings.
f = FilterLowercase() f("HELLO") 'hello'
Source code in baygon/filters.py
110 111 112 113 114 115 116 117 118 119 | |
FilterTrim ¶
Bases: Filter
Filter for trimmed strings.
f = FilterTrim() f(" hello ") 'hello'
Source code in baygon/filters.py
122 123 124 125 126 127 128 129 130 131 132 133 | |
FilterIgnoreSpaces ¶
Bases: Filter
Filter for strings with no spaces.
f = FilterIgnoreSpaces() f("hello world") 'helloworld'
Source code in baygon/filters.py
136 137 138 139 140 141 142 143 144 145 | |
FilterReplace ¶
Bases: Filter
Filter for strings with simple replacements.
f = FilterReplace("hello", "world") f("hello world") 'world world'
Source code in baygon/filters.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
FilterRegex ¶
Bases: Filter
Filter for strings using regular expressions.
f = FilterRegex("[aeiou]", "-") f("hello world") 'h-ll- w-rld'
Source code in baygon/filters.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
FilterEval ¶
Bases: Filter
Filter for evaluating mustaches in strings.
Source code in baygon/filters.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
apply(value)
Evaluate mustaches in a string.
Source code in baygon/filters.py
205 206 207 208 209 210 211 212 213 214 | |
exec(code)
Execute code in the kernel.
Source code in baygon/filters.py
216 217 218 219 220 221 222 223 224 225 226 227 | |
Filters ¶
Bases: Filter, Sequence
A sequence of filters.
Source code in baygon/filters.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
FilterFactory ¶
Factory for filters.
Source code in baygon/filters.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
Functions¶
register_filter ¶
register_filter(name=None)
Register a filter so it can be referenced from configuration.
Usage examples:
@register_filter ... class FilterFoo(Filter): ...
@register_filter("bar") ... class CustomFilter(Filter): ...
Source code in baygon/filters.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
get_registered_filters ¶
get_registered_filters()
Return a copy of the registered filters mapping.
Source code in baygon/filters.py
85 86 87 | |
helpers ¶
Classes¶
GreppableString ¶
Bases: str
A string that can be parsed with regular expressions.
Source code in baygon/helpers.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
grep(pattern, *args)
Return True if the pattern is found in the string.
GreppableString("hello world").grep("w.{3}d") ['world'] GreppableString("hello world").grep(r"[a-z]{4}") []
Source code in baygon/helpers.py
31 32 33 34 35 36 37 38 39 | |
contains(value)
Return True if the value is found in the string.
GreppableString("hello world").contains("world") True GreppableString("hello world").contains("earth") False
Source code in baygon/helpers.py
41 42 43 44 45 46 47 48 49 | |
Functions¶
escape_argument ¶
escape_argument(arg)
Escape a command line argument.
print(escape_argument("hello")) hello print(escape_argument("hello world")) 'hello world' print(escape_argument("hello'world'")) 'hello'"'"'world'"'"''
Source code in baygon/helpers.py
5 6 7 8 9 10 11 12 13 14 15 | |
create_command_line ¶
create_command_line(args)
Create a command line from a list of arguments.
print(create_command_line(["echo", "hello world"])) echo 'hello world'
Source code in baygon/helpers.py
18 19 20 21 22 23 24 25 | |
id ¶
Hierarchical Id class to identify nested sequences
Classes¶
Id ¶
Bases: Sequence
Test identifier. Helper class to number tests.
Example:
i = Id() i = i.down() i Id(1.1) i += 1 i Id(1.2) i += 2 i Id(1.4) str(i) '1.4' i.up() Id(1) ((i + 1).down() + 1).down() Id(1.5.2.1) tuple(Id().down().next().down().next().down().next()) (1, 2, 2, 2)
Source code in baygon/id.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
next()
Return a new Id with the last id incremented.
Source code in baygon/id.py
45 46 47 | |
down(base=1)
Return a new Id with the given id appended.
Source code in baygon/id.py
49 50 51 | |
up()
Return a new Id with the given id appended.
Source code in baygon/id.py
53 54 55 | |
pad(length=' ')
Return id with initial padding.
Source code in baygon/id.py
81 82 83 | |
TrackId ¶
Keep the id of the test.
Source code in baygon/id.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | |
reset()
Reset the id.
Source code in baygon/id.py
92 93 94 95 96 97 98 99 | |
down()
Return a new Id with the given id appended.
Source code in baygon/id.py
101 102 103 104 105 106 107 108 | |
up()
Return a new Id with the given id appended.
Source code in baygon/id.py
110 111 112 113 114 115 116 117 | |
next()
Return a new Id with the last id incremented.
Source code in baygon/id.py
119 120 121 122 123 124 125 126 127 | |
matchers ¶
Output matchers used to assert command results.
Classes¶
InvalidCondition ¶
Invalid test case condition.
Source code in baygon/matchers.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
InvalidExitStatus ¶
Bases: InvalidCondition
Invalid exit status error.
Source code in baygon/matchers.py
31 32 33 34 35 | |
InvalidContains ¶
Bases: InvalidCondition
Invalid contains error.
Source code in baygon/matchers.py
38 39 40 41 42 43 44 45 | |
InvalidRegex ¶
Bases: InvalidCondition
Invalid regex error.
Source code in baygon/matchers.py
48 49 50 51 52 53 54 | |
InvalidEquals ¶
Bases: InvalidCondition
Invalid equals error.
Source code in baygon/matchers.py
57 58 59 60 61 62 | |
MatchBase ¶
Bases: ABC
Base class for all matchers.
Source code in baygon/matchers.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
MatchRegex ¶
Bases: MatchBase
Match a regex.
Source code in baygon/matchers.py
111 112 113 114 115 116 117 118 119 120 121 122 123 | |
MatchContains ¶
Bases: MatchBase
Match if a string contains a specific value.
Source code in baygon/matchers.py
126 127 128 129 130 131 132 133 134 135 136 137 138 | |
MatchEquals ¶
Bases: MatchBase
Match if a string contains a specific value.
Source code in baygon/matchers.py
141 142 143 144 145 146 147 148 149 150 151 152 153 | |
MatcherFactory ¶
Factory for matchers.
Source code in baygon/matchers.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
Functions¶
register_matcher ¶
register_matcher(name=None)
Register a matcher class that can be referenced from configuration.
Source code in baygon/matchers.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
get_registered_matchers ¶
get_registered_matchers()
Return the registered matchers mapping.
Source code in baygon/matchers.py
106 107 108 | |
presentation ¶
Presentation helpers for Baygon reports.
Modules¶
rich ¶
Rich presentation utilities for Baygon.
render_summary_table(report, *, console)
Render a summary table for the given report.
Source code in baygon/presentation/rich.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
render_pretty_failures(report, *, console)
Render rich failure panels for failing cases.
Source code in baygon/presentation/rich.py
50 51 52 53 54 55 | |
render_command_panels(
result, *, console, hide_empty_streams
)
Render command telemetry panels for a case.
Source code in baygon/presentation/rich.py
58 59 60 61 62 63 64 65 66 67 | |
rich_presenter ¶
Rich presentation utilities for Baygon.
render_summary_table(report, *, console)
Render a summary table for the given report.
Source code in baygon/presentation/rich.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
render_pretty_failures(report, *, console)
Render rich failure panels for failing cases.
Source code in baygon/presentation/rich.py
50 51 52 53 54 55 | |
render_command_panels(
result, *, console, hide_empty_streams
)
Render command telemetry panels for a case.
Source code in baygon/presentation/rich.py
58 59 60 61 62 63 64 65 66 67 | |
text ¶
Plain-text presentation of Baygon run reports.
render_case_results(
report, *, write, verbose=0, include_issues=True
)
Render individual case outcomes.
Source code in baygon/presentation/text.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
render_summary(report, *, write)
Render the global summary for a run.
Source code in baygon/presentation/text.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
text_presenter ¶
Plain-text presentation of Baygon run reports.
render_case_results(
report, *, write, verbose=0, include_issues=True
)
Render individual case outcomes.
Source code in baygon/presentation/text.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
render_summary(report, *, write)
Render the global summary for a run.
Source code in baygon/presentation/text.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
runtime ¶
Runtime execution services.
Classes¶
BaygonRunner ¶
Execute suites described by immutable models.
Source code in baygon/runtime/runner.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
run(limit=-1)
Run the test suite.
Source code in baygon/runtime/runner.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
CaseResult
dataclass
¶
Individual case execution result.
Source code in baygon/runtime/runner.py
30 31 32 33 34 35 36 37 38 39 | |
CommandLog
dataclass
¶
Captured information about a single executed command.
Source code in baygon/runtime/runner.py
19 20 21 22 23 24 25 26 27 | |
RunReport
dataclass
¶
Aggregated information after running a suite.
Source code in baygon/runtime/runner.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
Modules¶
runner ¶
Pure runner built on top of Baygon domain models.
dataclass
¶Captured information about a single executed command.
Source code in baygon/runtime/runner.py
19 20 21 22 23 24 25 26 27 | |
dataclass
¶Individual case execution result.
Source code in baygon/runtime/runner.py
30 31 32 33 34 35 36 37 38 39 | |
dataclass
¶Aggregated information after running a suite.
Source code in baygon/runtime/runner.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
Execute suites described by immutable models.
Source code in baygon/runtime/runner.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
run(limit=-1)
Run the test suite.
Source code in baygon/runtime/runner.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
schema ¶
Schema definition and validation for Baygon configurations.
Classes¶
FiltersConfig ¶
Bases: BaseModel
Filters available at the configuration or case level.
Source code in baygon/schema.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
EvalConfig ¶
Bases: BaseModel
Configuration of the Jinja-like evaluation filters.
Source code in baygon/schema.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
NegatedCondition ¶
Bases: BaseModel
Negative matcher definition.
Source code in baygon/schema.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
CaseCondition ¶
Bases: BaseModel
Matchers applied to stdout/stderr values.
Source code in baygon/schema.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
CommonSettings ¶
Bases: BaseModel
Shared configuration items for suites, groups and test cases.
Source code in baygon/schema.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
TestCaseModel ¶
Bases: CommonSettings
Single executable test case.
Source code in baygon/schema.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
TestGroupModel ¶
Bases: CommonSettings
Group of tests that share settings.
Source code in baygon/schema.py
216 217 218 219 220 221 222 | |
BaygonConfig ¶
Bases: CommonSettings
Top-level Baygon configuration.
Source code in baygon/schema.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
Functions¶
Schema ¶
Schema(data, humanize=False)
Validate the given data against the Baygon schema.
Source code in baygon/schema.py
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | |
score ¶
Module used to compute the score of a test case. Used in academic.
Functions¶
float_or_int ¶
float_or_int(value)
Return a float or an integer.
float_or_int(1.0) 1 float_or_int(1.1) 1.1
Source code in baygon/score.py
8 9 10 11 12 13 14 15 16 17 | |
distribute ¶
distribute(values, total, min_value)
Distrubute the values given using a minimum step to ensure the total sum is respected.
distribute([1, 2, 3, 4], 10, 0.001) [1, 2, 3, 4] distribute([1, 1, 1, 1], 100, 0.01) [25, 25, 25, 25] distribute([12.5, 19.7, 42.1, 8.9], 100, 0.2) [15, 23.7, 50.6, 10.7] distribute([100, 100, 200, 200], 50, 1) [8, 8, 17, 17]
Source code in baygon/score.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
assign_points ¶
assign_points(test, parent=None)
Assign points recursively to each test in the structure.
Source code in baygon/score.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
has_weights_or_points ¶
has_weights_or_points(test)
Check if there are weights or points in the test or its subtests.
has_weights_or_points({"weight": 10}) True
Source code in baygon/score.py
152 153 154 155 156 157 158 159 160 161 | |
compute_points ¶
compute_points(data)
Compute points for the entire structure.
Source code in baygon/score.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
suite ¶
High-level services for loading and running Baygon suites.
Classes¶
SuiteContext
dataclass
¶
Immutable bundle describing a suite ready to be executed.
Source code in baygon/suite.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
create_runner(
*, executable=None, runner_factory=BaygonRunner
)
Return a runner configured for this suite.
Source code in baygon/suite.py
53 54 55 56 57 58 59 60 61 62 63 64 | |
SuiteBuilder ¶
Build immutable suite models from validated configuration mappings.
Source code in baygon/suite.py
67 68 69 70 71 72 73 74 75 76 77 78 79 | |
SuiteLoader ¶
Load suite configurations from files or raw mappings.
Source code in baygon/suite.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
from_mapping(data, *, cwd=None)
Validate a raw mapping and build its execution context.
Source code in baygon/suite.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
from_path(path)
Load configuration from disk and build its execution context.
Source code in baygon/suite.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
load(*, data=None, path=None, cwd=None)
Load a suite configuration from a mapping or a path.
Source code in baygon/suite.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
SuiteExecutor ¶
Execute suites described by SuiteContext.
Source code in baygon/suite.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
run(context, *, executable=None, limit=-1)
Run the suite described by the provided context.
Source code in baygon/suite.py
158 159 160 161 162 163 164 165 166 167 168 169 170 | |
SuiteService ¶
Facade coordinating loading and execution of Baygon suites.
Source code in baygon/suite.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
load(*, data=None, path=None, cwd=None)
Return a validated suite context without running it.
Source code in baygon/suite.py
184 185 186 187 188 189 190 191 192 | |
run(
*,
data=None,
path=None,
cwd=None,
executable=None,
limit=-1
)
Load and execute a suite in one call.
Source code in baygon/suite.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
Functions¶
find_testfile ¶
find_testfile(path=None)
Return the path to the first Baygon configuration file found.
Source code in baygon/suite.py
22 23 24 25 26 27 | |
load_config ¶
load_config(path=None)
Load and validate a configuration file (YAML or JSON).
Source code in baygon/suite.py
30 31 32 | |