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

feat: use new SDK standard tests framework #5

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
# Only lint using the primary version used for dev
python-version: [3.9]
python-version: ["3.10"]

steps:
- uses: actions/checkout@v2
Expand All @@ -23,7 +23,7 @@ jobs:
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.1.12
version: "1.3.2"
- name: Install dependencies
run: |
poetry install
Expand All @@ -39,7 +39,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand All @@ -50,7 +50,7 @@ jobs:
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.1.11
version: "1.3.2"
- name: Install dependencies
run: |
poetry install
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.vscode/

# Test and sample output files
.output

Expand Down
7 changes: 0 additions & 7 deletions .vscode/settings.json

This file was deleted.

6 changes: 6 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[mypy]
python_version = 3.10
warn_unused_configs = True

[mypy-backoff.*]
ignore_missing_imports = True
1,664 changes: 1,037 additions & 627 deletions poetry.lock

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ authors = ["AJ Steers"]
license = "Apache 2.0"

[tool.poetry.dependencies]
python = "<3.10,>=3.6.2"
python = "<3.11,>=3.7.1"
requests = "^2.25.1"
singer-sdk = "^0.3.10"
singer-sdk = {git = "https://github.com/meltano/sdk.git", rev = "kgpayne/issue1169", extras=["testing"]}

[tool.poetry.dev-dependencies]
pytest = "^6.1.2"
flake8 = "^3.9.2"
mypy = "^0.910"
black = {version = "^21.9b0", allow-prereleases = true}
black = "^22.3.0"
types-pytz = "^2021.3.3"
tox = "^3.24.5"
isort = "^5.10.1"
Expand Down
25 changes: 0 additions & 25 deletions target_csv/tests/test_core.py

This file was deleted.

File renamed without changes.
3 changes: 3 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Test Configuration."""

pytest_plugins = ("singer_sdk.testing.pytest_plugin",)
25 changes: 25 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Tests standard target features using the built-in SDK tests library."""
import shutil
import uuid
from pathlib import Path

import pytest
from singer_sdk.testing import get_target_test_class

from target_csv.target import TargetCSV

test_output_dir = Path(f".output/test_{uuid.uuid4()}/")

SAMPLE_CONFIG = {"max_parallelism": 1, "output_path_prefix": f"{test_output_dir}/"}

StandardTestsTargetCSV = get_target_test_class(
target_class=TargetCSV, config=SAMPLE_CONFIG
)


class TestTargetCSV(StandardTestsTargetCSV):
@pytest.fixture(scope="class")
def resource(self):
test_output_dir.mkdir(parents=True, exist_ok=True)
yield test_output_dir
shutil.rmtree(test_output_dir)
File renamed without changes.
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file can be used to customize tox tests as well as other test frameworks like flake8 and mypy

[tox]
envlist = py38
envlist = py310
; envlist = py37, py38, py39
isolated_build = true

Expand All @@ -14,12 +14,12 @@ commands =
poetry run black --check target_csv/
poetry run flake8 target_csv
poetry run pydocstyle target_csv
poetry run mypy target_csv --exclude='target_csv/tests'
poetry run mypy target_csv

[testenv:pytest]
# Run the python tests.
# To execute, run `tox -e pytest`
envlist = py37, py38, py39
envlist = py37, py38, py39, 310, 311
commands =
poetry install -v
poetry run pytest
Expand All @@ -42,7 +42,7 @@ commands =
poetry run flake8 target_csv
# poetry run pydocstyle target_csv # TODO: Uncomment when docstrings are compliant
# refer to mypy.ini for specific settings
poetry run mypy target_csv --exclude='target_csv/tests'
poetry run mypy target_csv

[flake8]
ignore = W503
Expand Down