Skip to content

Commit

Permalink
Fix fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Jul 4, 2024
1 parent f76adc6 commit a09c240
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 38 deletions.
40 changes: 40 additions & 0 deletions tap_github/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from __future__ import annotations

import datetime

import pytest


@pytest.fixture()
def repo_list_config(request):
"""Get a default list of repos or pass your own by decorating your test with
@pytest.mark.repo_list(['org1/repo1', 'org2/repo2'])
"""
marker = request.node.get_closest_marker("repo_list")
if marker is None:
repo_list = ["MeltanoLabs/tap-github", "mapswipe/mapswipe"]
else:
repo_list = marker.args[0]

return {
"metrics_log_level": "warning",
"start_date": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d"),
"repositories": repo_list,
"rate_limit_buffer": 100,
}


@pytest.fixture()
def username_list_config(request):
"""Get a default list of usernames or pass your own by decorating your test with
@pytest.mark.username_list(['ericboucher', 'aaronsteers'])
"""
marker = request.node.get_closest_marker("username_list")
username_list = ["ericboucher", "aaronsteers"] if marker is None else marker.args[0]

return {
"metrics_log_level": "warning",
"start_date": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d"),
"user_usernames": username_list,
"rate_limit_buffer": 100,
}
35 changes: 0 additions & 35 deletions tap_github/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,41 +25,6 @@ def search_config():
}


@pytest.fixture()
def repo_list_config(request):
"""Get a default list of repos or pass your own by decorating your test with
@pytest.mark.repo_list(['org1/repo1', 'org2/repo2'])
"""
marker = request.node.get_closest_marker("repo_list")
if marker is None:
repo_list = ["MeltanoLabs/tap-github", "mapswipe/mapswipe"]
else:
repo_list = marker.args[0]

return {
"metrics_log_level": "warning",
"start_date": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d"),
"repositories": repo_list,
"rate_limit_buffer": 100,
}


@pytest.fixture()
def username_list_config(request):
"""Get a default list of usernames or pass your own by decorating your test with
@pytest.mark.username_list(['ericboucher', 'aaronsteers'])
"""
marker = request.node.get_closest_marker("username_list")
username_list = ["ericboucher", "aaronsteers"] if marker is None else marker.args[0]

return {
"metrics_log_level": "warning",
"start_date": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d"),
"user_usernames": username_list,
"rate_limit_buffer": 100,
}


@pytest.fixture()
def user_id_list_config(request):
"""Get a default list of usernames or pass your own by decorating your test with
Expand Down
4 changes: 1 addition & 3 deletions tap_github/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
from tap_github.tap import TapGitHub
from tap_github.utils.filter_stdout import nostdout

from .fixtures import (
alternative_sync_children,
)
from .fixtures import alternative_sync_children


# Run standard built-in tap tests from the SDK:
Expand Down

0 comments on commit a09c240

Please sign in to comment.