From 1494d738b275103759b1141bc71d511ff89cd7a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Fri, 2 Feb 2024 22:04:04 -0600 Subject: [PATCH] docs: Add reference docs for tap & target testing helpers --- ...dk.authenticators.APIAuthenticatorBase.rst | 2 +- docs/conf.py | 2 +- docs/testing.md | 23 +++++++++++++++---- poetry.lock | 4 ++-- pyproject.toml | 5 ++-- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/docs/classes/singer_sdk.authenticators.APIAuthenticatorBase.rst b/docs/classes/singer_sdk.authenticators.APIAuthenticatorBase.rst index 70e9a127fb..1b3b608c5a 100644 --- a/docs/classes/singer_sdk.authenticators.APIAuthenticatorBase.rst +++ b/docs/classes/singer_sdk.authenticators.APIAuthenticatorBase.rst @@ -5,4 +5,4 @@ .. autoclass:: APIAuthenticatorBase :members: - :special-members: __init__, __call__ + :special-members: __init__, __call__ \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index d47fcab8bc..1b91724f03 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -56,7 +56,7 @@ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # Show typehints in the description, along with parameter descriptions -autodoc_typehints = "signature" +autodoc_typehints = "description" autodoc_class_signature = "separated" autodoc_member_order = "groupwise" diff --git a/docs/testing.md b/docs/testing.md index 19ad02ef0f..1f8c97e333 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -10,7 +10,7 @@ The Meltano SDK test framework consists of 4 main components: 1. A runner class (`TapTestRunner` and `TargetTestRunner`), responsible for executing Taps/Targets and capturing their output. 1. A suite dataclass, containing a list of tests. 1. A test template classes (`TapTestTemplate`, `StreamTestTemplate`, `AttributeTestTemplate` and `TargetTestTemplate`), with methods to `.setup()`, `.test()`, `.validate()` and `.teardown()` (called in that order using `.run()`). -1. `get_tap_test_class` and `get_target_test_class` factory methods. These wrap a `get_test_class` factory method, which takes a runner and a list of suites and return a `pytest` test class. +1. {func}`get_tap_test_class ` and {func}`get_target_test_class ` factory methods. These wrap a `get_test_class` factory method, which takes a runner and a list of suites and return a `pytest` test class. ## Example Usage @@ -76,7 +76,7 @@ class TestTargetExample(StandardTargetTests): ## Configuring Tests -Test suite behaviors can be configured by passing a `SuiteConfig` instance to the `get_test_class` functions: +Test suite behaviors can be configured by passing a {func}`SuiteConfig ` instance to the `get_test_class` functions: ```python from singer_sdk.testing import SuiteConfig, get_tap_test_class @@ -101,7 +101,7 @@ TestTapStackExchange = get_tap_test_class( ) ``` -Check out [`singer_sdk/testing/config.py`](https://github.com/meltano/sdk/tree/main/singer_sdk/testing/config.py) for available config options. +Check out [the reference](#reference) for more information on the available configuration options. ## Writing New Tests @@ -127,6 +127,21 @@ my_custom_tap_tests = TestSuite( ) ``` -This suite can now be passed to `get_tap_test_class` or `get_target_test_class` in a list of `custom_suites` along with any other suites, to generate your custom test class. +This suite can now be passed to {func}`get_tap_test_class ` or {func}`get_target_test_class ` in a list of `custom_suites` along with any other suites, to generate your custom test class. If your new test covers a common or general case, consider contributing to the standard test library via a pull request to [meltano/sdk](https://github.com/meltano/sdk). + +## Reference + +```{eval-rst} +.. autofunction:: singer_sdk.testing.get_tap_test_class +``` + +```{eval-rst} +.. autofunction:: singer_sdk.testing.get_target_test_class +``` + +```{eval-rst} +.. autoclass:: singer_sdk.testing.SuiteConfig + :members: +``` diff --git a/poetry.lock b/poetry.lock index e21215e4fa..6b9ef9c8b2 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2626,7 +2626,7 @@ docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.link testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ignore-flaky", "pytest-mypy (>=0.9.1)", "pytest-ruff"] [extras] -docs = ["furo", "myst-parser", "sphinx", "sphinx-autobuild", "sphinx-copybutton", "sphinx-inline-tabs", "sphinx-notfound-page", "sphinx-reredirects"] +docs = ["furo", "myst-parser", "pytest", "sphinx", "sphinx-autobuild", "sphinx-copybutton", "sphinx-inline-tabs", "sphinx-notfound-page", "sphinx-reredirects"] faker = ["faker"] parquet = ["numpy", "numpy", "pyarrow"] s3 = ["fs-s3fs"] @@ -2635,4 +2635,4 @@ testing = ["pytest", "pytest-durations"] [metadata] lock-version = "2.0" python-versions = ">=3.8" -content-hash = "cf326e02c7b02fbe1d12a80b3d16a4485357799c06585b3a36b025ad02bde08f" +content-hash = "56214b1bc1880ddec382a731f9d34a4ba8e2e72c81677d7c51defe3ea5de435f" diff --git a/pyproject.toml b/pyproject.toml index 2da0373225..cb8c52972e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -95,10 +95,11 @@ faker = {version = "~=22.5", optional = true} [tool.poetry.extras] docs = [ - "sphinx", "furo", - "sphinx-copybutton", "myst-parser", + "pytest", + "sphinx", + "sphinx-copybutton", "sphinx-autobuild", "sphinx-inline-tabs", "sphinx-notfound-page",