behave-framework/conftest.py

25 lines
521 B
Python
Raw Normal View History

2020-09-16 16:02:39 +00:00
import configparser
2024-07-23 14:48:03 +00:00
import os
2020-09-16 16:02:39 +00:00
2024-07-23 14:00:35 +00:00
import pytest
2020-09-18 09:46:11 +00:00
2024-07-23 14:48:03 +00:00
CWD = os.path.dirname(os.path.realpath(__file__))
2020-09-16 16:02:39 +00:00
config = configparser.ConfigParser()
@pytest.fixture(scope="session", autouse=True)
def headless():
2024-07-23 14:48:03 +00:00
config_file = os.path.join(CWD, "fixtures.ini")
dev_config = _read_config_section(config_file, 'dev')
return _str_to_bool(dev_config["headless"])
2020-09-16 16:02:39 +00:00
def _read_config_section(source, section):
config.read(source)
return config[section]
def _str_to_bool(s):
return s.lower() in ['true', '1', 'yes']