-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f45482
commit b09efe6
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# contributing | ||
|
||
unlike many projects, i try to make mine as easy as possible for other developers to work on by committing IDE config files and using tools such as pyprojectx to automate the installation of all the dev dependencies, so the steps to get set up are quite straightforward: | ||
|
||
## prerequisites | ||
|
||
- python (>=3.8) | ||
- vscode (optional) | ||
- shows inline errors for all linters used in the CI | ||
- there are tasks configured in the project to make installing dependencies and running tests more convenient | ||
|
||
## installation steps | ||
|
||
1. clone the repo | ||
2. run `./pw install` | ||
3. if using vscode, click "Yes" when prompted to use the project venv and when prompted to install the recommended extensions | ||
|
||
## tests | ||
|
||
since this is a pytest plugin, we have are two types of tests: | ||
|
||
- the plugin tests (located in [`./tests/test_python.py`](./tests/test_python.py) and [`./tests/test_robot.py`](./tests/test_robot.py)) - these use pytester to run pytest against the fixture tests | ||
- the "fixture" tests ([`./tests/fixtures`](`./tests/fixtures`)) - the tests that the plugin tests run and validate the results of | ||
|
||
each plugin test is tied to a fixture test by the test name. for example, the following test runs the fixture test at [`./tests/fixtures/test_pythoon/test_one_test_passes.py`](`./tests/fixtures/test_pythoon/test_one_test_passes.py`): | ||
|
||
```py | ||
# ./tests/test_python.py | ||
def test_one_test_passes(pytester_dir: PytesterDir): | ||
run_and_assert_result(pytester_dir, passed=1) | ||
assert_log_file_exists(pytester_dir) | ||
``` | ||
|
||
the `pytester_dir` fixture is an extension of [pytester](https://docs.pytest.org/en/7.1.x/reference/reference.html#pytester) which gets the path to the current test file relative to the `tests` directory (`./test_python.py`) and ties it to a folder in `./tests/fixtures` with the same name (minus the `.py`, ie. `./tests/fixtures/test_python`), then looks for either a python or robot file in that directory with the same name as the test (`test_one_test_passes.py` or `test_one_test_passes.robot`), or a folder if the test requires multiple files. | ||
|
||
TL;DR: the test `tests/suite_name.py::test_name` looks in `tests/fixtures/suite_name` for a file called `test_name.py`, `test_name.robot` or a folder called `test_name`, then runs pytest with the robotframework plugin on the tests there |