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

Update pytest examples for contributors #9800

Merged
merged 1 commit into from
Mar 23, 2024

Conversation

dbeatty10
Copy link
Contributor

@dbeatty10 dbeatty10 commented Mar 22, 2024

resolves #9788

Problem

These pytest example commands don't work for me when following the contributing instructions:

# run all unit tests in a file
python3 -m pytest tests/unit/test_graph.py
# run a specific unit test
python3 -m pytest tests/unit/test_graph.py::GraphTest::test__dependency_list
# run specific Postgres functional tests
python3 -m pytest tests/functional/sources

Instead, I get errors like this:

E       AttributeError: 'Namespace' object has no attribute 'SEND_ANONYMOUS_USAGE_STATS'

core/dbt/contracts/graph/manifest.py:1647: AttributeError
========================================== short test summary info ==========================================
FAILED tests/unit/test_graph.py::GraphTest::test__dependency_list - AttributeError: 'Namespace' object has no attribute 'SEND_ANONYMOUS_USAGE_STATS'

Solution

These would probably be better examples to use (and they worked for me):

# run all unit tests in a file
python3 -m pytest tests/unit/test_base_column.py
# run a specific unit test
python3 -m pytest tests/unit/test_base_column.py::TestNumericType::test__numeric_type
# run specific Postgres functional tests
python3 -m pytest tests/functional/sources

Testing

Manual testing of the code examples within CONTRIBUTING.md is sufficient to complete this issue since it doesn't affect the delivered code.

I tested that the updated example commands run without any errors.

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • Tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc)
  • This PR does not include any new type annotations because there are not any new and modified functions

@dbeatty10 dbeatty10 added the Skip Changelog Skips GHA to check for changelog file label Mar 22, 2024
@dbeatty10 dbeatty10 requested a review from a team as a code owner March 22, 2024 15:34
@cla-bot cla-bot bot added the cla:yes label Mar 22, 2024
Copy link

codecov bot commented Mar 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.04%. Comparing base (c6c0c79) to head (4311be9).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9800      +/-   ##
==========================================
- Coverage   88.09%   88.04%   -0.05%     
==========================================
  Files         178      178              
  Lines       22461    22461              
==========================================
- Hits        19787    19776      -11     
- Misses       2674     2685      +11     
Flag Coverage Δ
integration 85.42% <ø> (-0.14%) ⬇️
unit 61.73% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Member

@emmyoop emmyoop left a comment

Choose a reason for hiding this comment

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

Thank you!

@dbeatty10 dbeatty10 merged commit c071868 into main Mar 23, 2024
62 checks passed
@dbeatty10 dbeatty10 deleted the dbeatty/update-pytest-examples branch March 23, 2024 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes Skip Changelog Skips GHA to check for changelog file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update pytest examples for contributors
2 participants