Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore dbt package tests when running Cosmos tests #1502

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

tatiana
Copy link
Collaborator

@tatiana tatiana commented Feb 3, 2025

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

Avoid errors such as:
====================================================================== 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'))

When running hatch run tests.py3.9-2.9:test-cov
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Feb 3, 2025
Copy link

netlify bot commented Feb 3, 2025

Deploy Preview for sunny-pastelito-5ecb04 canceled.

Name Link
🔨 Latest commit b6135fb
🔍 Latest deploy log https://app.netlify.com/sites/sunny-pastelito-5ecb04/deploys/67a0ebcdc9b1190008e034e9

@dosubot dosubot bot added the area:testing Related to testing, like unit tests, integration tests, etc label Feb 3, 2025
Copy link

codecov bot commented Feb 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.11%. Comparing base (9c175f6) to head (b6135fb).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1502   +/-   ##
=======================================
  Coverage   97.11%   97.11%           
=======================================
  Files          77       77           
  Lines        4501     4501           
=======================================
  Hits         4371     4371           
  Misses        130      130           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@pankajkoti pankajkoti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for adding to ignore these.

@tatiana tatiana merged commit be44d7c into main Feb 3, 2025
69 checks passed
@tatiana tatiana deleted the pytest-dbt-utils-error branch February 3, 2025 16:47
@tatiana tatiana added this to the Cosmos 1.9.0 milestone Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:testing Related to testing, like unit tests, integration tests, etc size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants