-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
separate common from load tests properly
- Loading branch information
Showing
12 changed files
with
55 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,36 @@ | ||
from tests.sources.sql_database.conftest import * # noqa: F403 | ||
from typing import Iterator | ||
|
||
import pytest | ||
|
||
import dlt | ||
from dlt.sources.credentials import ConnectionStringCredentials | ||
from tests.sources.sql_database.sql_source import SQLAlchemySourceDB | ||
|
||
|
||
def _create_db(**kwargs) -> Iterator[SQLAlchemySourceDB]: | ||
# TODO: parametrize the fixture so it takes the credentials for all destinations | ||
credentials = dlt.secrets.get( | ||
"destination.postgres.credentials", expected_type=ConnectionStringCredentials | ||
) | ||
|
||
db = SQLAlchemySourceDB(credentials, **kwargs) | ||
db.create_schema() | ||
try: | ||
db.create_tables() | ||
db.insert_data() | ||
yield db | ||
finally: | ||
db.drop_schema() | ||
|
||
|
||
@pytest.fixture(scope="package") | ||
def sql_source_db(request: pytest.FixtureRequest) -> Iterator[SQLAlchemySourceDB]: | ||
# Without unsupported types so we can test full schema load with connector-x | ||
yield from _create_db(with_unsupported_types=False) | ||
|
||
|
||
@pytest.fixture(scope="package") | ||
def sql_source_db_unsupported_types( | ||
request: pytest.FixtureRequest, | ||
) -> Iterator[SQLAlchemySourceDB]: | ||
yield from _create_db(with_unsupported_types=True) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# almost all tests are in tests/load since a postgres instance is required for this to work |
This file was deleted.
Oops, something went wrong.