potiuk opened a new pull request, #51908:
URL: https://github.com/apache/airflow/pull/51908
The tests in airflow-ctl failed occasionally when run with xdist, also the
definition of the airflow-ctl dependencies in pyproject.toml did not properly
reflect dependencies needed to run the tests - they silently assumed that tests
are always run in a complete workspace, where all packages were installed. That
is pretty unnecessary and it was possible to improve the devel-common to handle
minimum set of requirements for airflow-ctl so that it does not have to install
unnecessary depedencies.
Since `airflow-ctl` does not now require airflow nor sqlalchemy for
installation and tests we can use the power of `uv` to automatically install
and run the tests without the need of CI image - airflow-ctl is supposed to be
small and standalone package so set of dependencies it has should make it
possible to install it without having all the 700+ dependencies in the CI nor
having system dependencies installed in Debian image.
Another problem was that when the tests were run with MacOS keyring, the
login test was hanging waiting for user entry.
This PR fixes those problems:
* devel-common distribution does not have to have airflow nor sqlalchemy as
dependency - this way airflow-ctl distribution can run tests without all
packages installed
* instead of platformdirs user_config_dir, we use direct retrieval of
configuration folder following airflow pattern (AIRLFOW_HOME or ~/airflow).
This allows to easily patch airflow home to use temporary directory for each
test - which solves the xdist failures when tests running in parallel were
overriding each-others config folder
* patching all paths that the test can ask for password makes it not hang
when keyring is installed
* breeze airflow-ctl tests perform `uv sync` in airflow-ctl directory in
order to make sure that no other dependencies are used during CI tests.
* test_command.py file is .gitignored and deleted after the test are run
* breeze testing airflow-ctl now does not require CI images to be run, we
are using `uv run` to autonaticaly install the venv in the right python
version, which simplifies and speeds up running.
* for airflow-ctl we use --use-local-hatch to build the packages locally
After this change running tests for airflow-ctl can be done very easily with:
* breeze testing airfllw-ctl --python N.N
or
* cd airflow-ctl; uv run --python N.N pytest
They should be equivalent.
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
Read the **[Pull Request
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
for more information.
In case of fundamental code changes, an Airflow Improvement Proposal
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party
License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a
newsfragment file, named `{pr_number}.significant.rst` or
`{issue_number}.significant.rst`, in
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]