Skip to content

Commit

Permalink
Merge pull request #1 from leukeleu/fix-tests
Browse files Browse the repository at this point in the history
Switch to legacy tests setup to be able to mock requests
  • Loading branch information
wadevries authored Sep 13, 2023
2 parents a36db9b + 3bc7443 commit ca9bc9b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 124 deletions.
127 changes: 13 additions & 114 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ requests = "^2.31.0"
[tool.poetry.group.dev.dependencies]
pytest = "^7.4.0"
singer-sdk = { version="^0.31.1", extras = ["testing"] }
requests-mock = "^1.11.0"

[tool.mypy]
python_version = "3.9"
Expand All @@ -34,7 +35,7 @@ ignore = [
]
select = ["ALL"]
src = ["tap_linear"]
target-version = "py311"
target-version = "py38"


[tool.ruff.flake8-annotations]
Expand Down
15 changes: 8 additions & 7 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@

import datetime

from singer_sdk.testing import get_tap_test_class
from singer_sdk.testing.legacy import get_standard_tap_tests

from tap_linear.tap import TapLinear

SAMPLE_CONFIG = {
"start_date": datetime.datetime.now(datetime.UTC).strftime("%Y-%m-%d"),
"start_date": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d"),
"auth_token": "test",
}


# Run standard built-in tap tests from the SDK:
TestTapLinear = get_tap_test_class(
tap_class=TapLinear,
config=SAMPLE_CONFIG,
)
def test_standard_tap_tests(requests_mock) -> None: # noqa: ANN001
"""Run standard built-in tap tests from the SDK."""
requests_mock.post("/graphql", json={"data": {"results": {"nodes": []}}})
tests = get_standard_tap_tests(TapLinear, config=SAMPLE_CONFIG)
for test in tests:
test()
4 changes: 2 additions & 2 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 = py37, py38, py39, py310, py311
envlist = py38, py39, py310, py311
isolated_build = true

[testenv]
Expand All @@ -13,7 +13,7 @@ commands =
[testenv:pytest]
# Run the python tests.
# To execute, run `tox -e pytest`
envlist = py37, py38, py39, py310, py311
envlist = py38, py39, py310, py311
commands =
poetry install -v
poetry run pytest

0 comments on commit ca9bc9b

Please sign in to comment.