This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new d01a1431616 Add extra paths note for tests (#47096)
d01a1431616 is described below
commit d01a1431616d29bcc26ee29e03d476ba06557a8e
Author: Mikhail Dengin <[email protected]>
AuthorDate: Wed Feb 26 12:33:18 2025 +0100
Add extra paths note for tests (#47096)
---
.../contributors_quick_start_vscode.rst | 35 +++++++++++++++++++++
.../images/vscode_add_extra_paths_item.png | Bin 0 -> 33685 bytes
.../images/vscode_settings_menu.png | Bin 0 -> 96778 bytes
3 files changed, 35 insertions(+)
diff --git
a/contributing-docs/quick-start-ide/contributors_quick_start_vscode.rst
b/contributing-docs/quick-start-ide/contributors_quick_start_vscode.rst
index 61fdf501063..d58942b1d1e 100644
--- a/contributing-docs/quick-start-ide/contributors_quick_start_vscode.rst
+++ b/contributing-docs/quick-start-ide/contributors_quick_start_vscode.rst
@@ -39,6 +39,41 @@ Setup your project
alt="Cloning github fork to Visual Studio Code">
</div>
+3. If you use official Python plugin you also have to add "tests" directly of
each
+ provider you want to develop as "Extra Paths". This way respective provider
tests code
+ can be addressed in imports as ``from unit.postgres.hooks.test_postgres
import ...``
+ This is important in Airflow 3.0 we split providers to be separate
distributions -
+ each with separate ``pyproject.toml`` file. This might improve and might be
better
+ automated in the future, but for now you need to do it for each provider
separately.
+
+ To do this, open ``File -> Preferences -> Settings``
+
+ .. raw:: html
+
+ <div align="center" style="padding-bottom:10px">
+ <img src="images/vscode_settings_menu.png"
+ alt="Open VS Code settings menu">
+ </div>
+
+ In ``Settings`` tab navigate to ``Workspace`` (this will set extra paths
only for this project)
+ and go to ``Extensions -> Pylance`` section. At ``Python -> Analysis: Extra
Paths`` add
+ the path to the tests directory of the provider you want to develop.
+
+ .. raw:: html
+
+ <div align="center" style="padding-bottom:10px">
+ <img src="images/vscode_add_extra_paths_item.png"
+ alt="Add providers test directory to Extra Paths in Pylance">
+ </div>
+
+ NB: if you use pyright as LSP with other editor you can set ``extraPaths``
the same
+ way in ``pyrightconfig.json``, see |pyright_conf_md|.
+
+ .. |pyright_conf_md| raw:: html
+
+ <a
href="https://github.com/microsoft/pyright/blob/main/docs/configuration.md"
target="_blank">pyright configuration docs</a>
+
+4. Once step 3 is done it is recommended to restart VS Code.
Setting up debugging
####################
diff --git
a/contributing-docs/quick-start-ide/images/vscode_add_extra_paths_item.png
b/contributing-docs/quick-start-ide/images/vscode_add_extra_paths_item.png
new file mode 100644
index 00000000000..868ab8ad555
Binary files /dev/null and
b/contributing-docs/quick-start-ide/images/vscode_add_extra_paths_item.png
differ
diff --git a/contributing-docs/quick-start-ide/images/vscode_settings_menu.png
b/contributing-docs/quick-start-ide/images/vscode_settings_menu.png
new file mode 100644
index 00000000000..9e96f6c7ef1
Binary files /dev/null and
b/contributing-docs/quick-start-ide/images/vscode_settings_menu.png differ