-
Notifications
You must be signed in to change notification settings - Fork 58
Generation using autorest for Python v5 dev mode
Laurent Mazuel edited this page May 5, 2020
·
6 revisions
Python 3.6 is required to run this new autorest
npm install -g autorest
If you already have autorest, be sure to execute autorest --reset
and at any sign of weird behavior to be sure it's not using anything that was pulled from before from npm.
- Clone the autorestv3 branch of autorest.python
git clone --single-branch --branch autorestv3 https://github.com/Azure/autorest.python.git
- Go to the root of the installed autorest.python repo and run
npm install
. This should generate a virtual environment with namevenv
at the root, which is essential for generating tests and making code changes. All generation must be done with this venv loaded.
See https://github.com/Azure/autorest.python/wiki/Autorest-v3-based-generator-cheatsheet#vscode-debug
- Activate your
venv
- Call
inv regenerate
from the repo root if you want to regenerate all of the test server swaggers - To generate a specific test server swagger, say BodyComplex, call
inv regenerate --swagger-name bodycomplex
For a complete mapping of swagger names to autorest test server swaggers, see the various mappings
- Recommend making two separate testing environments, one for vanilla tests and one for azure tests
- Install the requirements.txt for azure and vanilla in your respective virtual environments
- Run pytest from either test/azure or test/vanilla in your repo
It's actually as usual. Be sure --use
points to the folder where you cloned autorest, and that your venv is loaded.
Example:
autorest ..\azure-rest-api-specs\specification\storage\resource-manager\readme.md --use=. --python-sdks-folder=$SDK_FOLDER --python --multiapi --python-mode=update --keep-version-file