diff --git a/docs/source/basics.md b/docs/source/basics.md index 251a367f..4e8c1ca6 100644 --- a/docs/source/basics.md +++ b/docs/source/basics.md @@ -1949,7 +1949,11 @@ tests. These hooks are used by defining a function with the name of the hook in your `conftest.py` that take the same arguments _with the same names_ - these hooks -will then be picked up at runtime and called appropriately +will then be picked up at runtime and called appropriately. + +**NOTE**: These hooks should be considered a 'beta' feature, they are ready to +use but the names and arguments they take should be considered unstable and may +change in a future release (and more may also be added). ### Before every test run @@ -1968,7 +1972,7 @@ Example usage: ```python import logging -def pytest_tavern_before_every_test_run(test_dict, variables): +def pytest_tavern_beta_before_every_test_run(test_dict, variables): logging.info("Starting test %s", test_dict["test_name"]) variables["extra_var"] = "abc123" @@ -1990,7 +1994,7 @@ Args: Example usage: ```python -def pytest_tavern_after_every_response(expected, response): +def pytest_tavern_beta_after_every_response(expected, response): with open("logfile.txt", "a") as logfile: logfile.write("Got response: {}".format(response.json())) ``` diff --git a/example/hooks/conftest.py b/example/hooks/conftest.py index 08df1761..76164c7b 100644 --- a/example/hooks/conftest.py +++ b/example/hooks/conftest.py @@ -14,7 +14,7 @@ def setup_logging(): logging.basicConfig(level=logging.INFO) -def pytest_tavern_after_every_response(expected, response): +def pytest_tavern_beta_after_every_response(expected, response): global name logging.debug(expected) logging.debug(response) diff --git a/tavern/_plugins/mqtt/response.py b/tavern/_plugins/mqtt/response.py index 81aacd0b..e61f1805 100644 --- a/tavern/_plugins/mqtt/response.py +++ b/tavern/_plugins/mqtt/response.py @@ -80,7 +80,7 @@ def _await_response(self): call_hook( self.test_block_config, - "pytest_tavern_after_every_response", + "pytest_tavern_beta_after_every_response", expected=self.expected, response=msg, ) diff --git a/tavern/_plugins/rest/response.py b/tavern/_plugins/rest/response.py index f7cdb83f..8f3759ff 100644 --- a/tavern/_plugins/rest/response.py +++ b/tavern/_plugins/rest/response.py @@ -152,7 +152,7 @@ def verify(self, response): call_hook( self.test_block_config, - "pytest_tavern_after_every_response", + "pytest_tavern_beta_after_every_response", expected=self.expected, response=response, ) diff --git a/tavern/testutils/pytesthook/item.py b/tavern/testutils/pytesthook/item.py index 2b0c1ebe..4cc61ead 100644 --- a/tavern/testutils/pytesthook/item.py +++ b/tavern/testutils/pytesthook/item.py @@ -154,7 +154,7 @@ def runtest(self): call_hook( self.global_cfg, - "pytest_tavern_before_every_test_run", + "pytest_tavern_beta_before_every_test_run", test_dict=self.spec, variables=self.global_cfg["variables"], ) diff --git a/tavern/testutils/pytesthook/newhooks.py b/tavern/testutils/pytesthook/newhooks.py index 0bd08755..078e0263 100644 --- a/tavern/testutils/pytesthook/newhooks.py +++ b/tavern/testutils/pytesthook/newhooks.py @@ -4,7 +4,7 @@ logger = logging.getLogger(__name__) -def pytest_tavern_before_every_test_run(test_dict, variables): +def pytest_tavern_beta_before_every_test_run(test_dict, variables): """Called: - directly after fixtures are loaded for a test @@ -21,7 +21,7 @@ def pytest_tavern_before_every_test_run(test_dict, variables): """ -def pytest_tavern_after_every_response(expected, response): +def pytest_tavern_beta_after_every_response(expected, response): """Called after every _response_ - including MQTT/HTTP/etc Note: