How to Solve NameError: name 'pytest' is not defined

Solution: Import the 'pytest' module

# Add the following line to the top of your code
import pytest

 

For more information:
Python pytest