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 RedisConnectionError and exclude TypeChecking blocks from coverage #620

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

armanddidierjean
Copy link
Member

No description provided.

@armanddidierjean armanddidierjean added enhancement New feature or request test Improve test coverage labels Nov 25, 2024
Copy link

codecov bot commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.04%. Comparing base (08dcf2b) to head (8cd8904).
Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #620      +/-   ##
==========================================
- Coverage   81.26%   81.04%   -0.22%     
==========================================
  Files         128      130       +2     
  Lines        9949    10100     +151     
==========================================
+ Hits         8085     8186     +101     
- Misses       1864     1914      +50     

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

Daihecyy

This comment was marked as duplicate.

Copy link
Contributor

@Daihecyy Daihecyy left a comment

Choose a reason for hiding this comment

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

Consider changing xfail to skipif since the tests seem to be expected to run in Github actions.
Maybe create a shareable skipif decorator in test_commons ?

@armanddidierjean
Copy link
Member Author

Consider changing xfail to skipif since the tests seem to be expected to run in Github actions. Maybe create a shareable skipif decorator in test_commons ?

I'm not sure how I can decide if the test should be run as settings are not loaded when the file is imported. I think that failed test should raise an error in github action

@Daihecyy
Copy link
Contributor

Daihecyy commented Jan 5, 2025

Consider changing xfail to skipif since the tests seem to be expected to run in Github actions. Maybe create a shareable skipif decorator in test_commons ?

I'm not sure how I can decide if the test should be run as settings are not loaded when the file is imported. I think that failed test should raise an error in github action

But the tests passing would be considered "unexpedly passing" XPASS which is not really what we want.
We could do a similar thing as with override_get_db in tests/commons and return None if the redis client is not configured.
We could then skipif with the condition the redis client being None.
Such an approach would be a lot cleaner as we would not allow our tests to fail.

@Daihecyy
Copy link
Contributor

Daihecyy commented Jan 5, 2025

I must say that the way redis_client is handled in tests/commons is really weird to me.
Such a type redis.Redis | None | bool seems to indicate something is wrong.

armanddidierjean and others added 3 commits January 5, 2025 22:02
# Conflicts:
#	app/core/schemas_core.py
#	app/modules/cdr/endpoints_cdr.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request test Improve test coverage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants