Skip to content

Commit

Permalink
Ignore dbt package tests when running Cosmos tests (#1502)
Browse files Browse the repository at this point in the history
Avoid errors raised by Pytest, such as the below, because we had
installed `dbt deps` in one of Cosmos example dbt projects:
```
====================================================================== short test summary info =======================================================================
ERROR dags/dbt/altered_jaffle_shop/dbt_packages/dbt_utils/tests - _pytest.pathlib.ImportPathMismatchError: ('tests.conftest', '/Users/tati/Code/cosmos-fresh/astronomer-cosmos/tests/conftest.py', PosixPath('/Users/tati/Code/cosmos-fresh/astronomer-cosmos/dags/dbt/altered_jaffle_shop/dbt_packages/dbt_utils/tests/conftest.py'))
ERROR dev/dags/dbt/altered_jaffle_shop/dbt_packages/dbt_utils/tests - _pytest.pathlib.ImportPathMismatchError: ('tests.conftest', '/Users/tati/Code/cosmos-fresh/astronomer-cosmos/tests/conftest.py', PosixPath('/Users/tati/Code/cosmos-fresh/astronomer-cosmos/dev/dags/dbt/altered_jaffle_shop/dbt_packages/dbt_utils/tests/conftest.py'))
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================ 81 deselected, 5 warnings, 2 errors in 4.93s ============================================================

```

When running Cosmos test commands such as:

```
hatch run tests.py3.9-2.9:test-cov
```
  • Loading branch information
tatiana authored Feb 3, 2025
1 parent 3eb67bd commit be44d7c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ test-performance-setup = 'sh scripts/test/performance-setup.sh'
type-check = "pre-commit run mypy --files cosmos/**/*"

[tool.pytest.ini_options]
addopts = "--ignore-glob=**/dbt_packages/*"
filterwarnings = ["ignore::DeprecationWarning"]
minversion = "6.0"
markers = ["integration", "perf"]
Expand Down

0 comments on commit be44d7c

Please sign in to comment.