-
-
Notifications
You must be signed in to change notification settings - Fork 199
feat: add generic backends #981
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
Draft
michaelboulton
wants to merge
9
commits into
master
Choose a base branch
from
feat/generic-backends
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or 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
- Added test case to verify failure when a non-existent file is touched and validated (`some_other_file.txt`). - Added test case to validate failure for an invalid `touch_file` schema with a nonexistent field. - Added test case to validate failure for an invalid `file_exists` response schema with a nonexistent field. This enhances validation coverage for the custom backend by introducing negative test scenarios.
…tavern_plugin - Moved `example/custom_backend` to `example/custom_backend/my_tavern_plugin` for clearer structure. - Renamed `custom_backend` to `my_tavern_plugin` across all files, including `pyproject.toml`, test files, and paths. - Updated `tox-integration.ini` to reflect the new plugin path. - Adjusted `run_tests.sh` to use the updated plugin and test file paths. - Renamed and relocated `jsonschema.yaml` to match the new plugin directory. These changes improve project organization and better align naming conventions with intended functionality.
- Created `README.md` in `example/custom_backend` to provide an overview of the custom backend plugin. - Documented the implementation details, including `Request`, `Response`, `Session` classes, and supporting functions. - Added instructions for configuring the plugin in `pyproject.toml` and `pytest.ini`. - Included an example test case showcasing usage of `touch_file` and `file_exists` stages. This README serves as a guide for creating and using a custom backend plugin with Tavern.
…nation - Added details about why Tavern needs the `tavern-extra-backends` flag for custom backends. - Explained how Tavern defaults to loading only "grpc", "http", and "mqtt" backends and how the flag helps register a custom backend with Tavern. - Included a reference to `stevedore` for plugin loading for better clarity.
… pyproject.toml - Updated the `description` field in `pyproject.toml` to include more details about the custom generic plugin's functionality. - Adjusted the `requires-python` version from `>=3.14` to `>=3.12` for compatibility.
- Added a docstring to `Session` class to describe its purpose and context manager protocol implementation. - Added a docstring to `Request` class to explain its functionality, specifically touching a file during a request operation.
- Updated the example README to show the new `tavern-extra-backends` syntax, allowing a backend name without an explicit implementation and documenting entry‑point naming rules. - Enhanced the example `run_tests.sh` script with three test runs: using the default backend, specifying a custom implementation, and exercising the error case when a non‑existent implementation is requested. - Refactored plugin discovery in `tavern/_core/plugins.py`: - Added handling for backends with no explicit implementation (treated as default). - Tracked discovered plugins per backend and raise a `PluginLoadError` if multiple plugins are enabled for the same backend. - Updated the stevedore check function to use the new logic. - Modified extra backend parsing in `tavern/_core/pytest/util.py`: - Now accepts both `name` (default backend) and `name=value` forms. - Stores `None` for default backends and provides clearer error messages for malformed input. - Minor formatting improvements in configuration docs.
- Added a detailed docstring to the `is_plugin_backend_enabled` function in `tavern/_core/plugins.py`. - Clarified the purpose of the function, its arguments, and its return value. - Enhanced readability by documenting the function's role in checking backend enablement based on configuration. - Introduced the `stevedore.extension.Extension` type hint for better type clarity.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.