Skip to content

Conversation

@coopergillan
Copy link
Contributor

@coopergillan coopergillan commented Jan 31, 2020

Using pytest, consolidate the "True" or "happy path" tests into one parameterized test that uses a new TRUE_TESTS_CONFIG to drive test names and the week_day parameter.

Update all tests to use pytest, including regex matching on the failing tests as needed.


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.

Using pytest, consolidate the True tests into one parameterized test
that uses a master configuration. Also update all tests to use pytest,
including regex matching.
@coopergillan coopergillan force-pushed the AIRFLOW-6699-parameterize-weekday-tests branch from 1ecb6cb to 42e429c Compare January 31, 2020 21:01
@pytest.mark.parametrize("weekday", TRUE_TESTS_CONFIG.values(), ids=list(TRUE_TESTS_CONFIG.keys()))
def test_weekday_sensor_true(dag, weekday, tear_down):
op = DayOfWeekSensor(
task_id="weekday_sensor_check_true",
Copy link
Member

@mik-laj mik-laj Jan 31, 2020

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, that makes sense. Thank you for the heads up 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This helped me learn about how tests are parameterized here in airflow. Went with a different approach over in #7316.

@coopergillan
Copy link
Contributor Author

Closed in favor of #7316.

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.

2 participants