Skip to content

Latest commit

 

History

History
63 lines (39 loc) · 1.75 KB

DEVELOPMENT.md

File metadata and controls

63 lines (39 loc) · 1.75 KB

Azure Data Factory v2 - Unit Testing Framework

Development

Prerequisites

  • poetry == 1.6.1

Pre-Commit Hooks

We use pre-commit hooks to ensure that the code is formatted correctly and that the code is linted before committing.

To install the pre-commit hooks, run the following command:

poetry run pre-commit install

To run the pre-commit hooks use the following command (append --all-files to run on all files)):

poetry run pre-commit run

Run Linting

We use Ruff to lint our code as it provides similar rule sets to well-established linters into one (e.g., black, flake8, isort, and pydocstyle).

To run linting, run the following command:

poetry run ruff .

Run tests

We use pytest to test our code, coverage.py to generate coverage reports and coverage gutters VSCode extension to visualize code coverage in the editor.

To run all tests and generate coverage data run the following command:

poetry run coverage run --source=src -m pytest .

This will generate a .coverage file. To visualize code coverage, generate a coverage.xml file from the .coverage file by running:

poetry run coverage xml

Once the xml file is generated, you can view the coverage results in the editor by running the Coverage Gutters: Watch command.

To run tests and generate coverage.xml in a single command, run:

poetry run coverage run --source=src -m pytest . && coverage xml

Updating lock file

When updating Poetry's lock file your local cache can become outdated. You can clear your cache with poetry cache clear PyPI --all