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
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 | |
ConditionModel
dataclass
¶
Matcher configuration applied to stdout/stderr.
Source code in baygon/core/models.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
ExecutionResult
dataclass
¶
Lightweight execution summary for downstream reporting.
Source code in baygon/core/models.py
174 175 176 177 178 179 180 181 182 | |
GroupModel
dataclass
¶
Hierarchical test group definition.
Source code in baygon/core/models.py
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 | |
Methods:¶
iter_cases ¶
iter_cases()
Iterate over every leaf case contained in this group.
Source code in baygon/core/models.py
133 134 135 136 137 138 139 | |
NegatedConditionModel
dataclass
¶
Single negated matcher condition.
Source code in baygon/core/models.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
SuiteModel
dataclass
¶
Top-level immutable suite description.
Source code in baygon/core/models.py
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 | |
Methods:¶
iter_cases ¶
iter_cases()
Iterate over every test case in the suite.
Source code in baygon/core/models.py
165 166 167 168 169 170 171 | |
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
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 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
Methods:¶
run ¶
run(
*args,
stdin=None,
env=None,
hook=None,
timeout=None,
max_output=None
)
Run the program and grab all the outputs.
:param timeout: Wall-clock limit in seconds. Once reached, the program
and the processes it started are killed and the returned outputs
have timed_out set. None means no limit.
:param max_output: Number of bytes kept from each output stream. Once
a stream goes over it, the program is killed and the returned
outputs have output_limit_exceeded set. None uses
DEFAULT_MAX_OUTPUT, 0 means no limit.
Source code in baygon/executable.py
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 | |
BaygonRunner ¶
Execute suites described by immutable models.
Source code in baygon/runtime/runner.py
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 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 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 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | |
Attributes¶
Methods:¶
run ¶
run(limit=-1)
Run the test suite.
Source code in baygon/runtime/runner.py
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 265 | |
CaseResult
dataclass
¶
Individual case execution result.
Source code in baygon/runtime/runner.py
54 55 56 57 58 59 60 61 62 63 | |
CommandLog
dataclass
¶
Captured information about a single executed command.
Source code in baygon/runtime/runner.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
RunReport
dataclass
¶
Aggregated information after running a suite.
Source code in baygon/runtime/runner.py
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 | |
Methods:¶
as_dict ¶
as_dict(*, details=True)
Return the report as plain data, ready to be saved as JSON or YAML.
With details, the result of every test is listed under cases
and the subtotal of every group under groups.
Source code in baygon/runtime/runner.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
SuiteContext
dataclass
¶
Immutable bundle describing a suite ready to be executed.
Source code in baygon/suite.py
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 | |
Methods:¶
create_runner ¶
create_runner(
*,
executable=None,
runner_factory=BaygonRunner,
timeout=None,
max_output=None
)
Return a runner configured for this suite.
timeout and max_output are the defaults of the tests that set
no limit in the configuration.
Source code in baygon/suite.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
select ¶
select(*, ids=None, keywords=None)
Return a context running only the selected tests.
See baygon.core.models.select_tests.
Source code in baygon/suite.py
87 88 89 90 91 92 93 94 95 96 97 | |
SuiteExecutor ¶
Execute suites described by SuiteContext.
Source code in baygon/suite.py
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 | |
Methods:¶
run ¶
run(
context,
*,
executable=None,
limit=-1,
timeout=None,
max_output=None
)
Run the suite described by the provided context.
Source code in baygon/suite.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
SuiteLoader ¶
Load suite configurations from files or raw mappings.
Source code in baygon/suite.py
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 | |
Methods:¶
from_mapping ¶
from_mapping(data, *, cwd=None)
Validate a raw mapping and build its execution context.
Source code in baygon/suite.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
from_path ¶
from_path(path)
Load configuration from disk and build its execution context.
Source code in baygon/suite.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
load ¶
load(*, data=None, path=None, cwd=None)
Load a suite configuration from a mapping or a path.
Source code in baygon/suite.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
SuiteService ¶
Facade coordinating loading and execution of Baygon suites.
Source code in baygon/suite.py
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 | |
Methods:¶
load ¶
load(*, data=None, path=None, cwd=None)
Return a validated suite context without running it.
Source code in baygon/suite.py
220 221 222 223 224 225 226 227 228 | |
run ¶
run(
*,
data=None,
path=None,
cwd=None,
executable=None,
limit=-1,
timeout=None,
max_output=None
)
Load and execute a suite in one call.
Source code in baygon/suite.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
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
252 253 254 255 256 257 258 259 260 261 262 263 | |
Schema ¶
Schema(data, humanize=False)
Validate the given data against the Baygon schema.
Source code in baygon/schema.py
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 | |
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
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 | |
ConditionModel
dataclass
¶
Matcher configuration applied to stdout/stderr.
Source code in baygon/core/models.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
ExecutionResult
dataclass
¶
Lightweight execution summary for downstream reporting.
Source code in baygon/core/models.py
174 175 176 177 178 179 180 181 182 | |
GroupModel
dataclass
¶
Hierarchical test group definition.
Source code in baygon/core/models.py
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 leaf case contained in this group.
Source code in baygon/core/models.py
133 134 135 136 137 138 139 | |
NegatedConditionModel
dataclass
¶
Single negated matcher condition.
Source code in baygon/core/models.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
StdinCommandModel
dataclass
¶
Program whose standard output is given as input to a test.
Source code in baygon/core/models.py
72 73 74 75 76 77 | |
SuiteModel
dataclass
¶
Top-level immutable suite description.
Source code in baygon/core/models.py
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 | |
iter_cases()
Iterate over every test case in the suite.
Source code in baygon/core/models.py
165 166 167 168 169 170 171 | |
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
252 253 254 255 256 257 258 259 260 261 262 263 | |
parse_test_id ¶
parse_test_id(value)
Parse a dotted test identifier.
parse_test_id("2.1") (2, 1) parse_test_id(" 3 ") (3,)
Source code in baygon/core/models.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
select_tests ¶
select_tests(suite, *, ids=None, keywords=None)
Return a copy of the suite reduced to the selected tests.
A test is kept when its id starts with one of ids ("2" keeps the
whole group 2, "2.1" keeps test 2.1) and when its name, or the name of
one of its groups, contains one of keywords (case insensitive). An
empty criterion selects everything. Groups left without tests are removed,
ids and points are kept as they are in the full suite.
Source code in baygon/core/models.py
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 | |
Modules¶
models ¶
Immutable domain models for Baygon configurations and execution state.
dataclass
¶Single negated matcher condition.
Source code in baygon/core/models.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
dataclass
¶Matcher configuration applied to stdout/stderr.
Source code in baygon/core/models.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
dataclass
¶Program whose standard output is given as input to a test.
Source code in baygon/core/models.py
72 73 74 75 76 77 | |
dataclass
¶Leaf test case definition.
Source code in baygon/core/models.py
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 | |
dataclass
¶Hierarchical test group definition.
Source code in baygon/core/models.py
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 leaf case contained in this group.
Source code in baygon/core/models.py
133 134 135 136 137 138 139 | |
dataclass
¶Top-level immutable suite description.
Source code in baygon/core/models.py
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 | |
iter_cases()
Iterate over every test case in the suite.
Source code in baygon/core/models.py
165 166 167 168 169 170 171 | |
dataclass
¶Lightweight execution summary for downstream reporting.
Source code in baygon/core/models.py
174 175 176 177 178 179 180 181 182 | |
parse_test_id(value)
Parse a dotted test identifier.
parse_test_id("2.1") (2, 1) parse_test_id(" 3 ") (3,)
Source code in baygon/core/models.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
select_tests(suite, *, ids=None, keywords=None)
Return a copy of the suite reduced to the selected tests.
A test is kept when its id starts with one of ids ("2" keeps the
whole group 2, "2.1" keeps test 2.1) and when its name, or the name of
one of its groups, contains one of keywords (case insensitive). An
empty criterion selects everything. Groups left without tests are removed,
ids and points are kept as they are in the full suite.
Source code in baygon/core/models.py
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 | |
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
252 253 254 255 256 257 258 259 260 261 262 263 | |
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¶
Outputs ¶
Bases: namedtuple('Outputs', ['exit_status', 'stdout', 'stderr'])
Outputs of a program run.
It behaves as a (exit_status, stdout, stderr) tuple. Two extra
attributes tell whether the run was cut short:
timed_out: the program was killed after its time limit.output_limit_exceeded: the program was killed because one of its output streams went over the limit, the outputs are truncated.
Source code in baygon/executable.py
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 | |
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
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 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | |
run(
*args,
stdin=None,
env=None,
hook=None,
timeout=None,
max_output=None
)
Run the program and grab all the outputs.
:param timeout: Wall-clock limit in seconds. Once reached, the program
and the processes it started are killed and the returned outputs
have timed_out set. None means no limit.
:param max_output: Number of bytes kept from each output stream. Once
a stream goes over it, the program is killed and the returned
outputs have output_limit_exceeded set. None uses
DEFAULT_MAX_OUTPUT, 0 means no limit.
Source code in baygon/executable.py
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 | |
Functions:¶
get_env ¶
get_env(env=None)
Get the environment variables to be used for the subprocess.
Source code in baygon/executable.py
62 63 64 | |
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 231 232 233 234 | |
apply(value)
Evaluate mustaches in a string.
Source code in baygon/filters.py
210 211 212 213 214 215 216 217 218 219 | |
exec(code)
Execute code in the kernel.
Source code in baygon/filters.py
221 222 223 224 225 226 227 228 229 230 231 | |
Filters ¶
Bases: Filter, Sequence
A sequence of filters.
Source code in baygon/filters.py
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 275 276 277 278 279 280 281 282 283 284 | |
FilterFactory ¶
Factory for filters.
Source code in baygon/filters.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 | |
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
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |
InvalidExitStatus ¶
Bases: InvalidCondition
Invalid exit status error.
value is the expected status and expected the actual one, the order
used since the first versions.
str(InvalidExitStatus(0, 1)) 'Invalid exit status: expected 0, got 1.'
Source code in baygon/matchers.py
34 35 36 37 38 39 40 41 42 43 44 45 | |
ExecutionTimeout ¶
Bases: InvalidCondition
The program was killed after its time limit.
str(ExecutionTimeout(None, 1.5)) 'Timeout after 1.5 s.'
Source code in baygon/matchers.py
48 49 50 51 52 53 54 55 56 57 58 59 60 | |
OutputLimitExceeded ¶
Bases: InvalidCondition
An output stream went over the size limit, the program was killed.
str(OutputLimitExceeded(None, 1024)) 'Output limit exceeded (more than 1024 bytes), the program was killed.'
Source code in baygon/matchers.py
63 64 65 66 67 68 69 70 71 72 73 74 | |
ExecutionFailed ¶
Bases: InvalidCondition
The program could not be started.
Source code in baygon/matchers.py
77 78 79 80 81 | |
InvalidTestDefinition ¶
Bases: InvalidCondition
The test could not be evaluated (invalid regex, eval error...).
str(InvalidTestDefinition(ValueError("bad"), None)) 'Invalid test: ValueError: bad'
Source code in baygon/matchers.py
84 85 86 87 88 89 90 91 92 | |
InvalidNumber ¶
Bases: InvalidCondition
The output is not the expected number.
value is the output, expected describes the expectation.
Source code in baygon/matchers.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
InvalidCount ¶
Bases: InvalidCondition
The output does not have the expected number of characters or lines.
str(InvalidCount(4, "at most 3", unit="lines", on="stdout")) 'Output stdout has 4 lines, expected at most 3.'
Source code in baygon/matchers.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
InvalidSameAs ¶
Bases: InvalidCondition
The output differs from the output of the reference program.
str(InvalidSameAs("1", "2", reference="./ref", on="stdout")) "Output stdout '1' differs from the reference ./ref: '2'."
Source code in baygon/matchers.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
HelperProgramFailed ¶
Bases: InvalidCondition
A generator or reference program used by the test failed.
str(HelperProgramFailed("exit status 1", "Generator ./gen")) 'Generator ./gen failed: exit status 1.'
Source code in baygon/matchers.py
156 157 158 159 160 161 162 163 164 | |
InvalidContains ¶
Bases: InvalidCondition
Invalid contains error.
Source code in baygon/matchers.py
167 168 169 170 171 172 173 174 175 176 177 178 179 | |
InvalidRegex ¶
Bases: InvalidCondition
Invalid regex error.
Source code in baygon/matchers.py
182 183 184 185 186 187 188 189 190 191 192 193 | |
InvalidEquals ¶
Bases: InvalidCondition
Invalid equals error.
Source code in baygon/matchers.py
196 197 198 199 200 201 202 203 | |
MatchBase ¶
Bases: ABC
Base class for all matchers.
Source code in baygon/matchers.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
MatchRegex ¶
Bases: MatchBase
Match a regex.
Source code in baygon/matchers.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | |
MatchContains ¶
Bases: MatchBase
Match if a string contains a specific value.
Source code in baygon/matchers.py
269 270 271 272 273 274 275 276 277 278 279 280 281 | |
MatchEquals ¶
Bases: MatchBase
Match if a string contains a specific value.
Source code in baygon/matchers.py
284 285 286 287 288 289 290 291 292 293 294 295 296 | |
MatchNumber ¶
Bases: _RangeMatch
Match if the output is a number equal to a value or within a range.
MatchNumber({"value": 3.14, "tolerance": 0.01})(" 3.1416\n") is None True str(MatchNumber({"min": 0})("-1", on="stdout")) 'Output stdout is -1, expected at least 0.'
Source code in baygon/matchers.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | |
describe()
Describe the expected number.
Source code in baygon/matchers.py
367 368 369 370 371 372 373 | |
MatchLength ¶
Bases: _CountMatch
Match the number of characters of the output.
MatchLength({"max": 5})("hello") is None True
Source code in baygon/matchers.py
415 416 417 418 419 420 421 422 423 424 425 426 427 | |
MatchLines ¶
Bases: _CountMatch
Match the number of lines of the output.
str(MatchLines({"value": 2})("a\nb\nc\n", on="stdout")) 'Output stdout has 3 lines, expected exactly 2.'
Source code in baygon/matchers.py
430 431 432 433 434 435 436 437 438 439 440 441 442 | |
MatcherFactory ¶
Factory for matchers.
Source code in baygon/matchers.py
445 446 447 448 449 450 451 452 453 454 455 456 457 458 | |
Functions:¶
register_matcher ¶
register_matcher(name=None)
Register a matcher class that can be referenced from configuration.
Source code in baygon/matchers.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
get_registered_matchers ¶
get_registered_matchers()
Return the registered matchers mapping.
Source code in baygon/matchers.py
247 248 249 | |
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
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 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 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 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | |
run(limit=-1)
Run the test suite.
Source code in baygon/runtime/runner.py
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 265 | |
CaseResult
dataclass
¶
Individual case execution result.
Source code in baygon/runtime/runner.py
54 55 56 57 58 59 60 61 62 63 | |
CommandLog
dataclass
¶
Captured information about a single executed command.
Source code in baygon/runtime/runner.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
RunReport
dataclass
¶
Aggregated information after running a suite.
Source code in baygon/runtime/runner.py
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 | |
as_dict(*, details=True)
Return the report as plain data, ready to be saved as JSON or YAML.
With details, the result of every test is listed under cases
and the subtotal of every group under groups.
Source code in baygon/runtime/runner.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
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
38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
dataclass
¶Individual case execution result.
Source code in baygon/runtime/runner.py
54 55 56 57 58 59 60 61 62 63 | |
dataclass
¶Aggregated information after running a suite.
Source code in baygon/runtime/runner.py
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 | |
as_dict(*, details=True)
Return the report as plain data, ready to be saved as JSON or YAML.
With details, the result of every test is listed under cases
and the subtotal of every group under groups.
Source code in baygon/runtime/runner.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
Execute suites described by immutable models.
Source code in baygon/runtime/runner.py
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 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 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 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | |
run(limit=-1)
Run the test suite.
Source code in baygon/runtime/runner.py
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 265 | |
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
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 | |
EvalConfig ¶
Bases: BaseModel
Configuration of the Jinja-like evaluation filters.
Source code in baygon/schema.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
NumberSpec ¶
Bases: _RangeSpec
Expected number: 12.3, {value: 12.3, tolerance: 0.1}, {min: 0}.
Source code in baygon/schema.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
CountSpec ¶
Bases: _RangeSpec
Expected count (characters, lines): 3, {min: 1, max: 10}.
Source code in baygon/schema.py
207 208 209 210 211 212 213 214 215 216 217 218 219 | |
NegatedCondition ¶
Bases: BaseModel
Negative matcher definition.
Source code in baygon/schema.py
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 | |
CaseCondition ¶
Bases: BaseModel
Matchers applied to stdout/stderr values.
Source code in baygon/schema.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | |
CommonSettings ¶
Bases: BaseModel
Shared configuration items for suites, groups and test cases.
Source code in baygon/schema.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
StdinCommand ¶
Bases: BaseModel
Program whose output is given as standard input to the test.
Source code in baygon/schema.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | |
TestCaseModel ¶
Bases: CommonSettings
Single executable test case.
Source code in baygon/schema.py
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 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 394 395 396 | |
TestGroupModel ¶
Bases: CommonSettings
Group of tests that share settings.
Source code in baygon/schema.py
399 400 401 402 403 404 405 406 | |
BaygonConfig ¶
Bases: CommonSettings
Top-level Baygon configuration.
Source code in baygon/schema.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
Functions:¶
Schema ¶
Schema(data, humanize=False)
Validate the given data against the Baygon schema.
Source code in baygon/schema.py
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 | |
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 150 151 | |
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
154 155 156 157 158 159 160 161 162 163 | |
compute_points ¶
compute_points(data)
Compute points for the entire structure.
Source code in baygon/score.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | |
skill ¶
Install the Baygon skill for Claude Code.
Claude Code loads skills from ~/.claude/skills/<name>/ (all projects) and
.claude/skills/<name>/ (one project). The skill ships with the package and
is copied there on request with baygon --install-skill user|project.
Functions:¶
skill_source ¶
skill_source()
Return the directory holding the skill files (SKILL.md...).
Source code in baygon/skill.py
18 19 20 21 22 23 24 25 26 27 | |
skills_directory ¶
skills_directory(scope, *, cwd=None, home=None)
Return the skills directory for user, project or a given path.
Source code in baygon/skill.py
30 31 32 33 34 35 36 37 38 | |
install_skill ¶
install_skill(scope, *, cwd=None, home=None)
Copy the skill into the skills directory of scope.
Installing again replaces a previous copy of the Baygon skill, but never a directory that holds something else.
Returns:
| Type | Description |
|---|---|
Path
|
The directory the skill was installed in. |
Source code in baygon/skill.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
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
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 | |
create_runner(
*,
executable=None,
runner_factory=BaygonRunner,
timeout=None,
max_output=None
)
Return a runner configured for this suite.
timeout and max_output are the defaults of the tests that set
no limit in the configuration.
Source code in baygon/suite.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
select(*, ids=None, keywords=None)
Return a context running only the selected tests.
See baygon.core.models.select_tests.
Source code in baygon/suite.py
87 88 89 90 91 92 93 94 95 96 97 | |
SuiteBuilder ¶
Build immutable suite models from validated configuration mappings.
Source code in baygon/suite.py
100 101 102 103 104 105 106 107 108 109 110 111 112 | |
SuiteLoader ¶
Load suite configurations from files or raw mappings.
Source code in baygon/suite.py
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 | |
from_mapping(data, *, cwd=None)
Validate a raw mapping and build its execution context.
Source code in baygon/suite.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
from_path(path)
Load configuration from disk and build its execution context.
Source code in baygon/suite.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
load(*, data=None, path=None, cwd=None)
Load a suite configuration from a mapping or a path.
Source code in baygon/suite.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
SuiteExecutor ¶
Execute suites described by SuiteContext.
Source code in baygon/suite.py
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 | |
run(
context,
*,
executable=None,
limit=-1,
timeout=None,
max_output=None
)
Run the suite described by the provided context.
Source code in baygon/suite.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
SuiteService ¶
Facade coordinating loading and execution of Baygon suites.
Source code in baygon/suite.py
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 | |
load(*, data=None, path=None, cwd=None)
Return a validated suite context without running it.
Source code in baygon/suite.py
220 221 222 223 224 225 226 227 228 | |
run(
*,
data=None,
path=None,
cwd=None,
executable=None,
limit=-1,
timeout=None,
max_output=None
)
Load and execute a suite in one call.
Source code in baygon/suite.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | |
Functions:¶
find_testfile ¶
find_testfile(path=None)
Return the path to the first Baygon configuration file found.
Source code in baygon/suite.py
36 37 38 39 40 41 | |
load_config ¶
load_config(path=None)
Load and validate a configuration file (YAML or JSON).
Source code in baygon/suite.py
44 45 46 | |