Skip to content

Commit

Permalink
Merge branch 'handle-nans-in-flattening' of github.com:dgawlowsky/sdk…
Browse files Browse the repository at this point in the history
… into handle-nans-in-flattening
  • Loading branch information
dgawlowsky committed Mar 5, 2024
2 parents 704758b + 7392479 commit 9e38fea
Show file tree
Hide file tree
Showing 18 changed files with 263 additions and 134 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ pip==24.0
poetry==1.7.1
poetry-plugin-export==1.6.0
poetry-dynamic-versioning==1.2.0
pre-commit==3.6.0
pre-commit==3.6.1
nox==2023.4.22
nox-poetry==1.0.3
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ repos:
)$
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.4
rev: 0.28.0
hooks:
- id: check-dependabot
- id: check-github-workflows
- id: check-readthedocs

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
rev: v0.2.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on: [push]
jobs:
pytest:
runs-on: ubuntu-latest
continue-on-error: true
env:
GITHUB_TOKEN: {{ '${{secrets.GITHUB_TOKEN}}' }}
strategy:
Expand All @@ -24,6 +25,7 @@ jobs:
pip install poetry
- name: Install dependencies
run: |
poetry env use {{ '${{ matrix.python-version }}' }}
poetry install
- name: Test with pytest
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on: [push]
jobs:
pytest:
runs-on: ubuntu-latest
continue-on-error: true
env:
GITHUB_TOKEN: {{ '${{secrets.GITHUB_TOKEN}}' }}
strategy:
Expand All @@ -24,6 +25,7 @@ jobs:
pip install poetry
- name: Install dependencies
run: |
poetry env use {{ '${{ matrix.python-version }}' }}
poetry install
- name: Test with pytest
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on: [push]
jobs:
pytest:
runs-on: ubuntu-latest
continue-on-error: true
env:
GITHUB_TOKEN: {{ '${{secrets.GITHUB_TOKEN}}' }}
strategy:
Expand All @@ -24,6 +25,7 @@ jobs:
pip install poetry
- name: Install dependencies
run: |
poetry env use {{ '${{ matrix.python-version }}' }}
poetry install
- name: Test with pytest
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

.. autoclass:: APIAuthenticatorBase
:members:
:special-members: __init__, __call__
:special-members: __init__, __call__
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
23 changes: 19 additions & 4 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <singer_sdk.testing.get_tap_test_class>` and {func}`get_target_test_class <singer_sdk.testing.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

Expand Down Expand Up @@ -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 <singer_sdk.testing.SuiteConfig>` instance to the `get_test_class` functions:

```python
from singer_sdk.testing import SuiteConfig, get_tap_test_class
Expand All @@ -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

Expand All @@ -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 <singer_sdk.testing.get_tap_test_class>` or {func}`get_target_test_class <singer_sdk.testing.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:
```
11 changes: 1 addition & 10 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"coverage[toml]",
"duckdb",
"duckdb-engine",
"fastjsonschema",
"pyarrow",
"pytest",
"pytest-benchmark",
Expand All @@ -54,13 +55,6 @@
]


def _clean_py312_deps(session: Session, dependencies: list[str]) -> None:
"""Clean dependencies for Python 3.12."""
if session.python == "3.12":
dependencies.remove("duckdb")
dependencies.remove("duckdb-engine")


@session(python=main_python_version)
def mypy(session: Session) -> None:
"""Check types with mypy."""
Expand All @@ -86,7 +80,6 @@ def mypy(session: Session) -> None:
@session(python=python_versions)
def tests(session: Session) -> None:
"""Execute pytest tests and compute coverage."""
_clean_py312_deps(session, test_dependencies)
session.install(".[faker,parquet,s3]")
session.install(*test_dependencies)

Expand Down Expand Up @@ -120,7 +113,6 @@ def tests(session: Session) -> None:
@session(python=main_python_version)
def benches(session: Session) -> None:
"""Run benchmarks."""
_clean_py312_deps(session, test_dependencies)
session.install(".[s3]")
session.install(*test_dependencies)
sqlalchemy_version = os.environ.get("SQLALCHEMY_VERSION")
Expand All @@ -143,7 +135,6 @@ def update_snapshots(session: Session) -> None:
"""Update pytest snapshots."""
args = session.posargs or ["-m", "snapshot"]

_clean_py312_deps(session, test_dependencies)
session.install(".[faker]")
session.install(*test_dependencies)
session.run("pytest", "--snapshot-update", *args)
Expand Down
Loading

0 comments on commit 9e38fea

Please sign in to comment.