# Automatic Tests Re-Runs

Currently, rerunning flaky tests is supported in the `pytest` framework - see plugin [<mark style="color:blue;">here</mark>](https://github.com/aviator-co/pytest-aviator).

### Installation

**Step 1**: Install the plugin in your repository using pip or poetry:

```
pip install pytest-aviator
```

**Step 2**: Set your account's Aviator API token as an environment variable AVIATOR\_API\_TOKEN.

That’s it. Now when you run the tests using `pytest`, the plugin will automatically identify all flaky tests by querying the Aviator APIs and rerun depending on the configuration set in TestDeck.

## Add CI connections

Connect to your CI provider on the `Connections` page. We currently support CircleCI and Buildkite. You will need the provider API token in order for TestDeck to communicate with the provider. The instructions to generate API token can be count on the configuration page for the respective CI.

* [<mark style="color:blue;">CircleCI API Tokens</mark>](https://circleci.com/docs/managing-api-tokens)
* [<mark style="color:blue;">Buildkite API Tokens</mark>](https://buildkite.com/docs/apis/managing-api-tokens)

<figure><img src="/files/2FguELAsl2DP6tDfRZjD" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aviator.co/testdeck-beta/auto-rerun-tests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
