mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-03 08:32:44 +08:00
Support third-party stub external dependencies in pytype (#9449)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
@@ -17,7 +17,20 @@ objects at runtime.
|
||||
in the `tests` and `scripts` directories.
|
||||
|
||||
To run the tests, follow the [setup instructions](../CONTRIBUTING.md#preparing-the-environment)
|
||||
in the `CONTRIBUTING.md` document. In particular, we recommend running with Python 3.9+.
|
||||
in the `CONTRIBUTING.md` document. In particular, you have to run with Python 3.9+.
|
||||
|
||||
In order for `pytype_test` and `pyright_test` to work correctly, some third-party stubs
|
||||
may require extra dependencies external to typeshed to be installed in your virtual environment
|
||||
prior to running the test.
|
||||
You can list or install all of a stubs package's external dependencies using the following script:
|
||||
```bash
|
||||
(.venv3)$ python tests/get_external_stub_requirements.py <third_party_stub> # List external dependencies for <third_party_stub>
|
||||
(.venv3)$ python tests/get_external_stub_requirements.py <third_party_stub1> <third_party_stub2> # List external dependencies for <third_party_stub1> and <third_party_stub2>
|
||||
(.venv3)$ python tests/get_external_stub_requirements.py # List external dependencies for all third-party stubs in typeshed
|
||||
# Install external dependencies for all third-party stubs in typeshed
|
||||
(.venv3)$ DEPENDENCIES=$(python tests/get_external_stub_requirements.py)
|
||||
(.venv3)$ if [ -n "$DEPENDENCIES" ]; then pip install $DEPENDENCIES; fi
|
||||
```
|
||||
|
||||
## Run all tests for a specific stub
|
||||
|
||||
@@ -78,19 +91,6 @@ checks that would typically fail on incomplete stubs (such as `Unknown` checks).
|
||||
In typeshed's CI, pyright is run with these configuration settings on a subset of
|
||||
the stubs in typeshed (including the standard library).
|
||||
|
||||
In order for `pyright_test` to work correctly, some third-party stubs may require
|
||||
dependencies external to typeshed to be installed in your virtual environment
|
||||
prior to running the test.
|
||||
You can list or install all of a stubs package's external dependencies using the following script:
|
||||
```bash
|
||||
(.venv3)$ python tests/get_external_stub_requirements.py <third_party_stub> # List external dependencies for <third_party_stub>
|
||||
(.venv3)$ python tests/get_external_stub_requirements.py <third_party_stub1> <third_party_stub2> # List external dependencies for <third_party_stub1> and <third_party_stub2>
|
||||
(.venv3)$ python tests/get_external_stub_requirements.py # List external dependencies for all third-party stubs in typeshed
|
||||
# Install external dependencies for all third-party stubs in typeshed
|
||||
(.venv3)$ DEPENDENCIES=$(python tests/get_external_stub_requirements.py)
|
||||
(.venv3)$ if [ -n "$DEPENDENCIES" ]; then pip install $DEPENDENCIES; fi
|
||||
```
|
||||
|
||||
## regr\_test.py
|
||||
|
||||
This test runs mypy against the test cases for typeshed's stdlib and third-party
|
||||
|
||||
Reference in New Issue
Block a user