flakytest's pytest
plugin enables test tracking and management. This page will show you how to get it up and running.
pytest
plugin
pytest
and some tests (see example).
flakytest
pytest plugin:
pip install flakytest
FLAKYTEST_SECRET_TOKEN
environment variable and run:
export FLAKYTEST_SECRET_TOKEN={YOUR_SECRET_TOKEN}
pytest
You can skip this step if you have your own project that uses pytest
.
We have an example Python project that uses pytest
and some tests. Let's set it up.
Clone the example project
git clone https://github.com/anze3db/flakytest-python-example.git
Create a new virtual environment
python -m venv .venv
Activate the virtual environment
source .venv/bin/activate
Install the dependencies
pip install -r requirements.txt
And now we can finally run the tests
pytest
After running the pytest
command, you should see the following results:
Don't worry about the failing tests for now. The failures are intentional!
pytest
plugin
We will install the flakytest pytest plugin to start gathering test results.
pip install flakytest
Now the flakytest pytest plugin is installed, but we still need to enable it by providing a secret token.
Sign Up and create a flakytest.dev account. If you already have an account, make sure to log in.
To get a secret token, you have to first create a project. You will find the secret token on the project configuration page.
When the FLAKYTEST_SECRET_TOKEN
environment variable is set, the plugin will send test results to flakytest.dev. We can try this out by setting the environment variable and rerunning the pytest
command:
export FLAKYTEST_SECRET_TOKEN={YOUR_SECRET_TOKEN}
pytest
We can run the tests multiple times to get more data into flakytest.dev. After 3 runs, the results might look like this:
You have configured your project to send test results to flakytest.dev. 🎉
Next steps: