...

Execute a Fixture Only Once per Session

Execute a Fixture Only Once per Session

Pytest fixture allows you to use the same data to test different functions. Every time you use a pytest fixture in a test, a fixture will be executed.

This means that a fixture will be executed twice if used in two different tests.

If a fixture is expensive to execute, you can make the fixture be executed only once per session using scope=session

My previous tips on pytest.

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran

Seraphinite AcceleratorOptimized by Seraphinite Accelerator
Turns on site high speed to be attractive for people and search engines.