Skip to content

Commit

Permalink
Common-sense tox environment skipping (Azure#27487)
Browse files Browse the repository at this point in the history
* move exclusion list to a file within sdk-tools that we can import from random places in the CI. clean up tox_harness as the serial invocation is unused, untested, and worthless.
* type and doccomment all touched functions
* replacing in_ci in favor of ci_tools common version that also honors github actions
* enable filtering based on the opt out lists from the unified exclusion set
* rename tox environment from lint -> pylint. update single reference to said environment. update documentation to reflect new location of exclusion list
* re-add azure-ai-textanalytics and azure-ai-metricsadvisor to opt_out lists
* adding further cspell exclusions
  • Loading branch information
scbedd authored Nov 15, 2022
1 parent 42b3884 commit 3b1c811
Show file tree
Hide file tree
Showing 17 changed files with 501 additions and 586 deletions.
2 changes: 2 additions & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
"tools/azure-sdk-tools/setup.py"
],
"words": [
"qnamaker",
"mindependency",
"automl",
"pyyaml",
"CONLL",
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ sdist
```

Unfortunately, the command `tox -l` only returns the _default_ test builds. The common `tox.ini` file also supports `lint` and `mypy` environments.
Unfortunately, the command `tox -l` only returns the _default_ test builds. The common `tox.ini` file also supports `pylint` and `mypy` environments.

### Example Usage of the common Azure SDK For Python `tox.ini`

Expand Down Expand Up @@ -91,11 +91,11 @@ Used for the local dev loop.
```

#### `lint` environment
#### `pylint` environment
Pylint install and run.

```
\> tox -e lint -c <path to tox.ini>
\> tox -e pylint -c <path to tox.ini>
```


Expand Down
2 changes: 1 addition & 1 deletion doc/dev/static_type_checking.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ All client libraries in the Python SDK repo are automatically opted in to runnin
reason why a particular library should not run type checking, it is possible to add that library to a block list to prevent mypy/pyright
from running checks.

1) Place the package name on the appropriate block list: [eng/tox/environment_exclusion_list.py](https://github.com/Azure/azure-sdk-for-python/blob/main/eng/tox/environment_exclusion_list.py).
1) Place the package name on the appropriate block list: [tools/azure-sdk-tools/ci_tools/environment_exclusions.py](https://github.com/Azure/azure-sdk-for-python/blob/main/tools/azure-sdk-tools/ci_tools/environment_exclusions.py).
2) Open an issue tracking that "library-name" should be opted in to running type checking

> Note: Blocking your library from type checking is a *temporary* state. It is expected that checks are re-enabled as soon as possible.
Expand Down
49 changes: 31 additions & 18 deletions doc/dev/tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,36 @@ testing infrastructure, and demonstrates how to write and run tests for a servic

### Table of contents

- [Set up your development environment](#set-up-your-development-environment)
- [Integrate with pytest](#integrate-with-the-pytest-test-framework)
- [Use Tox](#tox)
- [The `devtools_testutils` package](#the-devtools_testutils-package)
- [Write or run tests](#write-or-run-tests)
- [Set up the test proxy](#perform-one-time-test-proxy-setup)
- [Set up test resources](#set-up-test-resources)
- [Configure credentials](#configure-credentials)
- [Start the test proxy server](#start-the-test-proxy-server)
- [Deliver environment variables to tests](#deliver-environment-variables-to-tests)
- [Write your tests](#write-your-tests)
- [Configure live or playback testing mode](#configure-live-or-playback-testing-mode)
- [Run and record tests](#run-and-record-tests)
- [Sanitize secrets](#sanitize-secrets)
- [Functional vs. unit tests](#functional-vs-unit-tests)
- [Further reading](#further-reading)
- [Deprecated testing instructions](#deprecated-testing-instructions)
- [Python SDK testing guide](#python-sdk-testing-guide)
- [Table of contents](#table-of-contents)
- [Set up your development environment](#set-up-your-development-environment)
- [SDK root directory](#sdk-root-directory)
- [Dependency installation](#dependency-installation)
- [Open code in IDE](#open-code-in-ide)
- [Integrate with the pytest test framework](#integrate-with-the-pytest-test-framework)
- [Tox](#tox)
- [The `devtools_testutils` package](#the-devtools_testutils-package)
- [Write or run tests](#write-or-run-tests)
- [Perform one-time test proxy setup](#perform-one-time-test-proxy-setup)
- [Set up test resources](#set-up-test-resources)
- [Configure credentials](#configure-credentials)
- [Start the test proxy server](#start-the-test-proxy-server)
- [Deliver environment variables to tests](#deliver-environment-variables-to-tests)
- [Write your tests](#write-your-tests)
- [Configure live or playback testing mode](#configure-live-or-playback-testing-mode)
- [Run and record tests](#run-and-record-tests)
- [Sanitize secrets](#sanitize-secrets)
- [Special case: SAS tokens](#special-case-sas-tokens)
- [Functional vs. unit tests](#functional-vs-unit-tests)
- [Further reading](#further-reading)
- [Deprecated testing instructions](#deprecated-testing-instructions)
- [Define credentials (deprecated)](#define-credentials-deprecated)
- [Create live test resources (deprecated)](#create-live-test-resources-deprecated)
- [Write your tests (deprecated)](#write-your-tests-deprecated)
- [An example test (deprecated)](#an-example-test-deprecated)
- [Run and record the test (deprecated)](#run-and-record-the-test-deprecated)
- [Purging secrets (deprecated)](#purging-secrets-deprecated)
- [Special case: Shared Access Signature (deprecated)](#special-case-shared-access-signature-deprecated)

## Set up your development environment

Expand Down Expand Up @@ -115,7 +128,7 @@ The Python SDK uses the [tox project](https://tox.readthedocs.io/en/latest/) to
To run a tox command from your directory use the following commands:
```cmd
(env) azure-sdk-for-python\sdk\my-service\my-package> tox -c ../../../eng/tox/tox.ini -e sphinx
(env) azure-sdk-for-python\sdk\my-service\my-package> tox -c ../../../eng/tox/tox.ini -e lint
(env) azure-sdk-for-python\sdk\my-service\my-package> tox -c ../../../eng/tox/tox.ini -e pylint
(env) azure-sdk-for-python\sdk\my-service\my-package> tox -c ../../../eng/tox/tox.ini -e mypy
(env) azure-sdk-for-python\sdk\my-service\my-package> tox -c ../../../eng/tox/tox.ini -e pyright
(env) azure-sdk-for-python\sdk\my-service\my-package> tox -c ../../../eng/tox/tox.ini -e verifytypes
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/templates/steps/run_pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ steps:
"$(TargetingString)"
--mark_arg="${{ parameters.TestMarkArgument }}"
--service="${{ parameters.ServiceDirectory }}"
--toxenv="lint"
--toxenv="pylint"
--disablecov
--filter-type="Omit_management"
env: ${{ parameters.EnvVars }}
Expand Down
Loading

0 comments on commit 3b1c811

Please sign in to comment.