Skip to main content

astrocloud dev pytest

Description

Run unit tests for your data pipelines on Astro with pytest, a testing framework for Python. When you run this command, the Astro CLI creates a local Python environment that includes your DAG code, dependencies, and Astro Runtime Docker image. The CLI then runs any pytests in the tests directory of your Astro project and shows you the results of those tests in your terminal.

For more information on this functionality, see Test and Troubleshoot Locally.

info

This command requires Astro Runtime version 4.1.0+. For more information, see Astro Runtime Release Notes.

Usage

astrocloud dev pytest

Options

OptionDescriptionPossible Values
<pytest-filepath>The filepath to an alternative pytest file or directory. Must be within the tests directoryAny valid filepath within the tests directory
-e, --envThe filepath to your environment variables. The default is .env)Any valid filepath within your Astro project

Examples

$ astrocloud dev pytest --env=myAlternativeEnvFile.env
# Specify env file at root of Astro project