Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(EXAMPLE) feat: add pytest flag to run v1 REST API tests #430

Closed
wants to merge 1 commit into from

Conversation

keithmanville
Copy link
Collaborator

@keithmanville keithmanville commented Apr 5, 2024

This feature adds a --run-v1 flag to pytest in tests/conftest.py to enable running of v1 API tests. To mark a test as v1, annotate the test function with @pytest.mark.v1.

We intend to use this feature during the development of v1 of the API. We expect tests to fail while the service layer is not implemented so v1 tests should be excluded by default.

To run only v1 tests use the command below:

python -m tox run -e py39-pytest -- tests/unit/restapi/v1 --run-v1

A copy of the v0 Queue tests has been placed in the v1 folder with the API_ROOT set to v1 and all tests marked as v1 as a demonstration of this feature. These tests to not properly exercise the new API and are expected to fail.

This feature adds a --run-v1 flag to pytest in `tests/conftest.py` to enable
running of v1 API tests. To mark a test as v1, annotate the test function
with `@pytest.mark.v1`.

We intend to use this feature during the development of v1 of the API.
We expect tests to fail while the service layer is not implemented so v1
tests should be excluded by default.

To run only v1 tests use the command below:
````
python -m tox run -e py39-pytest -- tests/unit/restapi/v1 --run-v1
```

A copy of the v0 Queue tests has been placed in the v1 folder with the
API_ROOT set to v1 and all tests marked as v1 as a demonstration of this
feature. These tests to not properly exercise the new API and are
expected to fail.
@keithmanville keithmanville linked an issue Apr 5, 2024 that may be closed by this pull request
3 tasks
@jkglasbrenner
Copy link
Collaborator

@keithmanville The conftest.py implementation that adds the --run-v1 option flag and defines @pytest.mark.v1 all looks good to me. I approve of getting the conftest.py file merged into dev and leaving this open as an example until we get some actual tests merged.

@keithmanville
Copy link
Collaborator Author

The conftest.py implementation is now merged into dev under PR #431.

This PR will be left open as an example of how to use the @pytest.mark.v1 decorator in a test.

@keithmanville
Copy link
Collaborator Author

The v1 queues tests are now merged into dev, so that is a better reference point. Closing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scaffolding for V1 integration tests
2 participants