Skip to content

Commit

Permalink
Refactor tests to be separated from application code (#313)
Browse files Browse the repository at this point in the history
Closes: #302

---------

Co-authored-by: Julian LaNeve <[email protected]>
  • Loading branch information
tatiana and jlaneve authored Jun 8, 2023
1 parent 374f8a1 commit 4e38f7b
Show file tree
Hide file tree
Showing 40 changed files with 22 additions and 55 deletions.
3 changes: 1 addition & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[run]
omit =
*/test_*
cosmos/tests/utils.py
tests/*
3 changes: 3 additions & 0 deletions cosmos/providers/dbt/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ def __init__(self, id: str, *args, **kwargs):

def __eq__(self, other) -> bool:
return self.id == other.id


__all__ = ["Dataset"]
51 changes: 0 additions & 51 deletions cosmos/providers/dbt/tests/test_dataset.py

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ matrix.airflow.dependencies = [
[tool.hatch.envs.tests.scripts]
freeze = "pip freeze"
test = 'pytest -vv --durations=0 . -m "not integration"'
test-cov = 'pytest -vv --cov=cosmos --cov-report=term-missing --cov-report=xml --durations=0 . -m "not integration"'
test-cov = 'pytest -vv --cov=cosmos --cov-report=term-missing --cov-report=xml --durations=0 -m "not integration"'
test-integration = "pytest -vv --cov=cosmos --cov-report=term-missing --cov-report=xml --durations=0 -m integration"

[tool.pytest.ini_options]
Expand Down
File renamed without changes.
File renamed without changes.
Empty file added tests/core/__init__.py
Empty file.
File renamed without changes.
Empty file added tests/providers/__init__.py
Empty file.
Empty file added tests/providers/dbt/__init__.py
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
File renamed without changes.
16 changes: 16 additions & 0 deletions tests/providers/dbt/test_dataset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
Tests Dataset export override
"""

import airflow

from cosmos.providers.dbt.dataset import Dataset


def test_import() -> None:
"Tests that we can import the Dataset object in all versions of Airflow."

if airflow.__version__ >= "2.4.0":
assert Dataset.__module__ == "airflow.datasets"
else:
assert Dataset.__module__ == "cosmos.providers.dbt.dataset"
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from . import utils as test_utils

EXAMPLE_DAGS_DIR = Path(__file__).parent.parent.parent / "dev/dags"
EXAMPLE_DAGS_DIR = Path(__file__).parent.parent / "dev/dags"
EXAMPLE_CONN_FILE = Path(__file__).parent / "test-connections.yaml"
AIRFLOW_IGNORE_FILE = EXAMPLE_DAGS_DIR / ".airflowignore"

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 4e38f7b

Please sign in to comment.