Closed c-ryan-k closed 1 year ago
do we need to update dev_requirements (ex: add tox)
Also would be nice if you can put the pr description into the page we have about testing
do we need to update dev_requirements (ex: add tox)
Also would be nice if you can put the pr description into the page we have about testing
tox is already in our dev_requirements - but I can absolutely work on a "tox testing guide", with this PR description as a base (and some examples of course)
I'm thrilled about this contribution
do we need to update dev_requirements (ex: add tox) Also would be nice if you can put the pr description into the page we have about testing
tox is already in our dev_requirements - but I can absolutely work on a "tox testing guide", with this PR description as a base (and some examples of course)
Will that tox testing guide be part of this PR or a follow up PR?
This overhauls our existing
tox.ini
to support the following local and pipeline test infrastructure. I highly advise giving their docs a quick overview, as it is much more in depth than this preview will cover.Local Tox
This changes nothing about how you currently run tests - local pytest and virtualenvs are untouched and unrelated. In order to perform any of these new tasks, you must install tox (currently in
dev_requirements
, so already part of dev setup) and have the azure-cli repo cloned alongside your extension repo.It supports local test configurations for the following environments (passed to tox with
-e "env"
):tox -e lint
-e
) will be parsed as such:py{thon,3.7,3.8,3.9,3.10}-az{min,cur,dev}-{int,unit}
{matrix}
section (or just pick one):tox -e "py{3.7,3.10}-az{min,dev}-unit"
azmin
installs the minimum supported CLI version (currently2.32.0
)azcur
installs the latest released CLI version from PyPiazdev
installs the CLI from your local (../azure-cli
) CLI instancetox -av
, which will display them all in a list:If you choose not to select a specific python version (which is also the current default), you can use
python
instead, to invoke whichever versionpython
invokes in your environment.Important notes
tox
, the current default environments (which can be changed inside tox.ini) are:lint
: which runs flake8 and pylintpython-azdev-unit
: which runs unit test only, on your default python version, against your local (pathed to../azure-cli
) CLI core version.-r
switch.Tox Pipeline
This also introduces a new![image](https://user-images.githubusercontent.com/13545962/217684622-291e7349-1110-430e-9f84-c4e8d4f02114.png)
tox
pipeline (more work to come), which adds switches for each python version and azure CLI version, and distributes those tasks to simultaneous jobs:This is currently a standalone pipeline, but the goal is to eventually configure this pipeline to utilize the existing built wheel and test SDK from our current pipelines to ensure our tests pass on all possible python and Azure CLI versions with very minimal user configuration.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Thank you for contributing to the IoT extension!
This checklist is used to make sure that common guidelines for a pull request are followed.
General Guidelines
Intent for Production
dev
ormain
are of production grade. Corollary to this, any merged contributions to these branches may be deployed in a public release at any given time. By checking this box, you agree and commit to the expected production quality of code.Basic expectations
pytest <project root> -vv
. Please provide evidence in the form of a screenshot showing a succesful run of tests locally OR a link to a test pipeline that has been run against the change-set..pylintrc
and.flake8
rules? Look at the CI scripts for example usage.Azure IoT CLI maintainers reserve the right to enforce any of the outlined expectations.
A PR is considered ready for review when all basic expectations have been met (or do not apply).