-
Notifications
You must be signed in to change notification settings - Fork 26
Unit Test Cleanup #368
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
Unit Test Cleanup #368
Conversation
Codecov Report
@@ Coverage Diff @@
## main #368 +/- ##
=======================================
Coverage 98.27% 98.27%
=======================================
Files 72 72
Lines 3996 3996
=======================================
Hits 3927 3927
Misses 69 69 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to test parametrize in class based approach
6785488
to
f3871a8
Compare
This shouldn't be a problem, I have checked in the apache repo |
What's the status of this PR? |
We can't have parametrize based function ? |
It is doable, it's a typo in the last comment, updated it. https://github.com/apache/airflow/blob/main/tests/providers/amazon/aws/hooks/test_base_aws.py#L704 |
@kaxil This was one of my suggestions to improve unit test reusability and readability during our retro call. I came up with some improvements for one module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, only thing can you add more description what is done on the cleanup activity, so that it can be avoided in the upcoming PR
@pankajastro can you please fix the Description |
@pankajastro can we merge this ? Is anything need to be done ? |
f3871a8
to
84c7b86
Compare
I'm in favour of merging it but let me re-evaluate it and get back to you. |
Updated the description please let me know how this looks |
I want to merge this but before going ahead I would like to know what other people think about these changes. WDYT @phanikumv @kaxil @pankajkoti @bharanidharan14 @rajaths010494 ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to hear opinions from others :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test coverage is dropping by 0.95% . Do we need to worry about it?
assert len(execution_dates) == 1 | ||
|
||
class TestExternalTaskSensorAsync: | ||
TASK_ID = "external_task_sensor_check" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add this variables inside setup_class like class variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mean I should create a setup class and keep this variable in that class? Can you please elaborate a little bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you can do like this
class Test:
def setup_class(self) -> None:
self.xxxx: str = ""
self.yyyyy: str = ''
self.connection_string = (
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or you can create def test_init() inside the class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these variables are just single lines and getting used in this class only so moving outside to a different class not sure how much value will add. regarding variables like conn which might get used in multiple test classes, I'm planning to keep them in util
If you see the delta changes #368 (comment) the coverage has dropped for most of the files which are not related to this PR so I don't think it matters much we still have all tests old test here |
84c7b86
to
e0f4dd0
Compare
Created a follow-up ticket #568 |
This is an attempt to improve the unit test case this PR will add the below value
create_context
method which is currently redundant at dozen of placeSince this PR have only changes for core providers so above points are currently applicable on core provider only
Closes: #294
Related to: #568