This commit is contained in:
Daniel 2023-12-08 18:43:01 +01:00
parent b0fb608e05
commit 47a829044c

View file

@ -67,7 +67,7 @@ Furthermore, some `Runner` classes can depend on others. For example, `RunnerWor
| 9. | Wordpress-2 | cleanups |
# Create a Runner
# Create a custom Runner
To comprehend the process of creating a new subclass of `Runner`, let's examine a simplified rendition of the `RunnerWordpress` class. Within it, there exist two setup scripts and two test scripts, one of which operates conditionally.
@ -88,3 +88,17 @@ class RunnerWordpress(Runner):
]
cleanups = []
```
The signature of condition functions can be seen below. The function takes one `NamedTuple` and returns of type `bool`. You can learn about the contents of the input by looking up the class `ConditionArgs`. Generally speaking, it provides access to all of the .env files, especially the one related to the current Runner.
```python
def condition_function(args: ConditionArgs) -> bool:
...
```
# Create custom Tests
The test files are written in the same way as any other pytest test file. The only difference is that pytest-abra provides custom fixtures that make it easy to get the configuration by the provided .env files and to deal with URLS etc.
# todo: add example