This is the test file that i am running.
# this file is test_define.py
import pytest
def test_it(aw_name):
print(aw_name)
if __name__ == '__main__':
pytest.main(['-s', 'v', '--aw_name', 'boom', 'test_define.py'])
This is the conftest file in the same directory
# conftest file
import pytest
def pytest_addoption(parser):
parser.addoption("--aw_name", action="store")
@pytest.fixture
def aw_name(request):
return request.config.getoption("aw_name")
Running this in terminal works properly and prints out:
% pytest -s -v --aw_name boom test_define.py
But when I run in pycharm using the play button for the "if name == 'main':" I always get a value of None. Am i missing something in the pytest.main call? I've also double checked that the interpreter is set to the same as the terminal.