Skip to content

Conversation

@coopergillan
Copy link
Contributor

@coopergillan coopergillan commented Jan 31, 2020

Using the parameterized library, consolidate the "true" or so-called "happy path" tests, reducing overall code to maintain and showing each test case in one list of tuples.

This makes it faster to add any other true test cases if need be.

For now, the "false" tests are different enough to remain as-is.


Issue link: AIRFLOW-6699

Make sure to mark the boxes below before creating PR: [x]

  • Description above provides context of the change
  • Commit message/PR title starts with [AIRFLOW-NNNN]. AIRFLOW-NNNN = JIRA ID*
  • Unit tests coverage for changes (not needed for documentation changes)
  • Commits follow "How to write a good git commit message"
  • Relevant documentation is updated including usage instructions.
  • I will engage committers as explained in Contribution Workflow Example.

* For document-only changes commit message can start with [AIRFLOW-XXXX].


In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.
Read the Pull Request Guidelines for more information.

@coopergillan
Copy link
Contributor Author

Note: I noticed usage of parameterized in tests/providers/sftp/hooks/test_sftp.py among other spots.

@coopergillan coopergillan force-pushed the AIRFLOW-6699-parameterize-weekday-tests-in-unittest branch 2 times, most recently from c33c47e to 6aa82b4 Compare January 31, 2020 22:03
Using the parameterized library, consolidate the true or "happy path"
tests, reducing overall code to maintain and showing each test case in
one list of tuples.
@coopergillan coopergillan force-pushed the AIRFLOW-6699-parameterize-weekday-tests-in-unittest branch from f3e4aa4 to 2fecab1 Compare January 31, 2020 22:10
@coopergillan
Copy link
Contributor Author

Pushed up two fixup commits and then squashed them into one.

@codecov-io
Copy link

codecov-io commented Jan 31, 2020

Codecov Report

Merging #7316 into master will increase coverage by 0.14%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7316      +/-   ##
==========================================
+ Coverage   85.82%   85.96%   +0.14%     
==========================================
  Files         863      866       +3     
  Lines       40484    41420     +936     
==========================================
+ Hits        34744    35608     +864     
- Misses       5740     5812      +72
Impacted Files Coverage Δ
airflow/executors/celery_executor.py 79.71% <0%> (-8.73%) ⬇️
airflow/executors/executor_loader.py 75% <0%> (-3.95%) ⬇️
airflow/providers/papermill/operators/papermill.py 96.42% <0%> (-3.58%) ⬇️
airflow/utils/decorators.py 89.36% <0%> (-1.12%) ⬇️
airflow/www/validators.py 100% <0%> (ø) ⬆️
airflow/www/forms.py 100% <0%> (ø) ⬆️
.../providers/amazon/aws/operators/cloud_formation.py 100% <0%> (ø)
...flow/providers/amazon/aws/hooks/cloud_formation.py 96.77% <0%> (ø)
...ow/providers/amazon/aws/sensors/cloud_formation.py 100% <0%> (ø)
airflow/models/taskinstance.py 94.97% <0%> (+0.25%) ⬆️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65b524a...2fecab1. Read the comment docs.

@mik-laj
Copy link
Member

mik-laj commented Jan 31, 2020

@coopergillan I see that you like order in tests. Wouldn't you like to organize one file?
https://github.com/apache/airflow/blob/master/tests/providers/apache/hive/operators/test_hive.py#L29-L40
This file contains tests for many unrelated components. I think it would be useful to transfer some tests to other files.
Here is an example: PolideaInternal@a91b612
To avoid conflicts you can do it in one PR, but it would be useful for each move to be in a separate commit. This will facilitate the review.

@coopergillan
Copy link
Contributor Author

coopergillan commented Jan 31, 2020 via email

Copy link
Member

@mik-laj mik-laj left a comment

Choose a reason for hiding this comment

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

Thanks!

@mik-laj mik-laj merged commit ea268b9 into apache:master Feb 2, 2020
@coopergillan
Copy link
Contributor Author

@mik-laj - is there already an Apache JIRA ticket for reorganizing those Hive tests? If not, I am happy to create one.

@coopergillan coopergillan deleted the AIRFLOW-6699-parameterize-weekday-tests-in-unittest branch February 2, 2020 22:07
@mik-laj
Copy link
Member

mik-laj commented Feb 2, 2020

@coopergillan Not yet. You must create a new ticket.

@coopergillan
Copy link
Contributor Author

Done: https://issues.apache.org/jira/browse/AIRFLOW-6721

Let me know if that is accurate based on what you mentioned.

@coopergillan
Copy link
Contributor Author

@mik-laj - I did start some of that work on organizing the Hive tests. Here is what I have so far:

https://github.com/apache/airflow/compare/master...coopergillan:AIRFLOW-6721-organize-hive-tests?expand=1

Do you think this is the right idea? Would love any other feedback on that. Thanks!

galuszkak pushed a commit to FlyrInc/apache-airflow that referenced this pull request Mar 5, 2020
Using the parameterized library, consolidate the true or "happy path"
tests, reducing overall code to maintain and showing each test case in
one list of tuples.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants