Maia Pytest Plugin

This guide covers how Maia Pytest Plugin works

Idea

Tests written using Maia Test Framework can be run via pytest. If you will run your tests just executing pytest then tests will be executed, but without additional information which Maia produces. For instance you won't be able to use our dashboard, because the framework won't generate json results.

If you would like to use the full power of Maia Test Framework we encourage to use our dedicated pytest plugin.

CLI

You can run pytest command with following parameters:

  • --maia-output-dir - this defines directory to save Maia test reports. Every pytest run generates new subdirectory with the name of current time. Under subdirectory, there will be generated json files per test file. As an example, if you have test file called basic_test.py and inside of it you have two tests: basic_1 and basic_2, then following structure will be created.
--<maia-output-dir>
  --2025-09-02_16_00_00
    --basic_1
    --basic_2

Note:

The above parameter can be used for a dashboard. Dashboard requires setting its own environment variable - see more here: Dashboard

  • maia-report - this defines directory to save unified Maia JSON test report. It can be useful if you would like to have all in one file, for instance for CI.

Note:

The above parameter will be soon supported also by the dashboard.

Alternative

You can omit --maia-output-dir by setting the dedicated environment variable called MAIA_TEST_OUTPUT_DIR. This will also let you generate many json test results.