Skip to content

Comments

Add lint flags to upgrade-test command#1829

Merged
jeremybeard merged 1 commit intomainfrom
ruff-af3-only
Apr 8, 2025
Merged

Add lint flags to upgrade-test command#1829
jeremybeard merged 1 commit intomainfrom
ruff-af3-only

Conversation

@jeremybeard
Copy link
Contributor

Description

This changes the recently added ruff tests of the astro dev upgrade-test command:

  • The option is now named around linting rather than ruff specifically
  • The default linting config only checks for breaking changes in Airflow 3 (AIR30 rules)
  • A new optional flag --lint-deprecations also checks for deprecations in Airflow 3 (AIR31 rules, which do not yet exist but will very soon)
  • A new optional flag --lint-config-file which overrides the ruff config entirely with a local file

🧪 Functional Testing

  • Unit tests added/updated
  • Manually tested for default configs, with deprecations, and with a provided config file

📋 Checklist

  • Rebased from the main (or release if patching) branch (before testing)
  • Ran make test before taking out of draft
  • Ran make lint before taking out of draft
  • Added/updated applicable tests
  • Tested against Astro-API (if necessary).
  • Tested against Houston-API and Astronomer (if necessary).
  • Communicated to/tagged owners of respective clients potentially impacted by these changes.
  • Updated any related documentation

cmd.Flags().BoolVarP(&versionTest, "version-test", "", false, "Only run version tests. These tests show you how the versions of your dependencies will change after you upgrade.")
cmd.Flags().BoolVarP(&dagTest, "dag-test", "d", false, "Only run DAG tests. These tests check whether your DAGs will generate import errors after you upgrade.")
cmd.Flags().BoolVarP(&ruffTest, "ruff-test", "r", false, "Only run ruff tests. These tests check whether your DAGs are compatible with Airflow 3.")
cmd.Flags().BoolVarP(&lintTest, "lint-test", "l", false, "Only run ruff lint tests. These tests check whether your DAGs are compatible with Airflow.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
cmd.Flags().BoolVarP(&lintTest, "lint-test", "l", false, "Only run ruff lint tests. These tests check whether your DAGs are compatible with Airflow.")
cmd.Flags().BoolVarP(&lintTest, "lint-test", "l", false, "Run ruff lint tests. These tests check whether your DAGs are compatible with Airflow.")

Sorry I just noticed it now, but I think the flag is set to true would ensure that the lint tests are run, and won't ensure that other tests don't run.
I think we should also update the description for dag-test and version-text flag, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The way it works (not defending it...) is that if all of the *-test flags are false then they all run, otherwise it is only the flags that are set to true. So "only run" is not quite right if you set more than one of them to true, but I wouldn't want to imply one only runs if you set its flag. Bit of a UX headache but being existing behavior I'd rather just leave it as is.

@jeremybeard jeremybeard merged commit 39979f9 into main Apr 8, 2025
3 of 4 checks passed
@jeremybeard jeremybeard deleted the ruff-af3-only branch April 8, 2025 12:52
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