From 5525b9d2744ac8c93831eafd92d3ea0a2e8d98b9 Mon Sep 17 00:00:00 2001 From: Eleanor Boyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Sun, 23 Feb 2025 16:34:08 -0800 Subject: [PATCH 1/2] edit docs to add autoTestDiscoverOnSavePattern --- docs/python/testing.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/python/testing.md b/docs/python/testing.md index ab2fadc2cc..5d52b6bca9 100644 --- a/docs/python/testing.md +++ b/docs/python/testing.md @@ -147,7 +147,7 @@ def test_decrement(): By default, the Python extension attempts to discover tests once you enable a framework. You can also trigger test discovery at any time using the **Test: Refresh Tests** command from the Command Palette. -`python.testing.autoTestDiscoverOnSaveEnabled` is set to `true` by default, meaning that test discovery is also performed automatically whenever you add, delete, or update any Python file in the workspace. To disable this feature, set the value to `false`, which can be done either in the Settings editor or in the `settings.json` file as described in the VS Code [Settings](/docs/editor/settings.md) documentation. You will need to reload the window for this setting to take effect. +`python.testing.autoTestDiscoverOnSaveEnabled` is set to `true` by default, meaning that test discovery is also performed automatically whenever you add, delete, or update any Python file in the workspace. To disable this feature, set the value to `false`, which can be done either in the Settings editor or in the `settings.json` file as described in the VS Code [Settings](/docs/editor/settings.md) documentation. You will need to reload the window for this setting to take effect. If `python.testing.autoTestDiscoverOnSaveEnabled` is set to true, you can refine when auto test discovery occurs by using the `python.testing.autoTestDiscoverOnSavePattern` setting, which specifies a glob pattern that determines which file changes trigger test discovery. Its default value is `**/*.py`. Test discovery applies the discovery patterns for the current framework (which can be customized using the [Test configuration settings](#test-configuration-settings)). The default behavior is as follows: @@ -384,6 +384,7 @@ The settings that affect the UI of the testing features are provided by VS Code | Setting
(python.testing.) | Default | Description | | --- | --- | --- | | autoTestDiscoverOnSaveEnabled | `true` | Specifies whether to enable or disable auto run test discovery when saving a test file. You may need to reload the window after making changes to this setting for it to be applied. | +| autoTestDiscoverOnSavePattern | `**/*.py` | Specifies a glob pattern so that determines which file changes trigger auto test discovery when `autoTestDiscoverOnSaveEnabled` is true. | | cwd | null | Specifies an optional working directory for tests. | | debugPort | `3000` | Port number used for debugging of unittest tests. | | promptToConfigure | `true` | Specifies whether VS Code prompts to configure a test framework if potential tests are discovered. | From 997706deb246249470debb36f693308a4f33018d Mon Sep 17 00:00:00 2001 From: Eleanor Boyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Mon, 24 Feb 2025 09:40:42 -0800 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Nick Trogh <1908215+ntrogh@users.noreply.github.com> --- docs/python/testing.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/python/testing.md b/docs/python/testing.md index 5d52b6bca9..3eea232116 100644 --- a/docs/python/testing.md +++ b/docs/python/testing.md @@ -147,7 +147,9 @@ def test_decrement(): By default, the Python extension attempts to discover tests once you enable a framework. You can also trigger test discovery at any time using the **Test: Refresh Tests** command from the Command Palette. -`python.testing.autoTestDiscoverOnSaveEnabled` is set to `true` by default, meaning that test discovery is also performed automatically whenever you add, delete, or update any Python file in the workspace. To disable this feature, set the value to `false`, which can be done either in the Settings editor or in the `settings.json` file as described in the VS Code [Settings](/docs/editor/settings.md) documentation. You will need to reload the window for this setting to take effect. If `python.testing.autoTestDiscoverOnSaveEnabled` is set to true, you can refine when auto test discovery occurs by using the `python.testing.autoTestDiscoverOnSavePattern` setting, which specifies a glob pattern that determines which file changes trigger test discovery. Its default value is `**/*.py`. +`python.testing.autoTestDiscoverOnSaveEnabled` is set to `true` by default, meaning that test discovery is also performed automatically whenever you add, delete, or update any Python file in the workspace. To disable this feature, set the value to `false`. You can refine for which files auto test discovery occurs by specifying a glob pattern in the `python.testing.autoTestDiscoverOnSavePattern` setting. Its default value is `**/*.py`. + +You can [configure the settings](/docs/editor/settings.md) in the Settings editor or directly in the `settings.json` file. You need to reload the window for the test discovery setting to take effect. Test discovery applies the discovery patterns for the current framework (which can be customized using the [Test configuration settings](#test-configuration-settings)). The default behavior is as follows: @@ -384,7 +386,7 @@ The settings that affect the UI of the testing features are provided by VS Code | Setting
(python.testing.) | Default | Description | | --- | --- | --- | | autoTestDiscoverOnSaveEnabled | `true` | Specifies whether to enable or disable auto run test discovery when saving a test file. You may need to reload the window after making changes to this setting for it to be applied. | -| autoTestDiscoverOnSavePattern | `**/*.py` | Specifies a glob pattern so that determines which file changes trigger auto test discovery when `autoTestDiscoverOnSaveEnabled` is true. | +| autoTestDiscoverOnSavePattern | `**/*.py` | Specifies a glob pattern that determines which file changes trigger auto test discovery when `autoTestDiscoverOnSaveEnabled` is `true`. | | cwd | null | Specifies an optional working directory for tests. | | debugPort | `3000` | Port number used for debugging of unittest tests. | | promptToConfigure | `true` | Specifies whether VS Code prompts to configure a test framework if potential tests are discovered. |