Skip to main content

Flake8 Linter

Flake8-Vedro is a specialized flake8 linter designed for the Vedro framework. It improves code quality in Vedro-based projects by enforcing rules that enhance maintainability and readability in test development.


To install flake8-vedro, run the following command:

$ pip install flake8-vedro


Consider an example project with this scenario:

# ./scenarios/
import vedro
import httpx

class Scenario(vedro.Scenario):
subject = ""

def given_book_id(self):
self.book_id = 1234

def when_user_retrieves_book(self):
self.response = httpx.get(f"/api/books/{self.book_id}")

def then_it_should_return_book_details(self):
assert self.response.json() == {
"id": self.book_id,
"title": "The Great Gatsby",
"author": "F. Scott Fitzgerald",

To check for linting errors, use the command below:

$ flake8

Executing this command will display output highlighting linting errors:

./scenarios/ E302 expected 2 blank lines, found 1
./scenarios/ VDR105 subject in scenario should not be empty

In this output, E302 is a standard Flake8 spacing rule, while VDR105 is a custom rule for Vedro ensuring scenarios have defined subjects.


Refer to the flake8-vedro repository for a complete list of rules


Since flake8-vedro is a Flake8 plugin, its configuration aligns with the Flake8 configuration guidelines.

For example, to ignore a specific rule such as VDR105, execute the following command:

$ flake8 --extend-ignore VDR105

Alternatively, add the rule to setup.cfg:

extend-ignore = VDR105