Skip to content

Commit

Permalink
style: format with new tools
Browse files Browse the repository at this point in the history
  • Loading branch information
steveoh committed Jun 27, 2023
1 parent 03b003b commit 418eab3
Show file tree
Hide file tree
Showing 7 changed files with 871 additions and 675 deletions.
34 changes: 18 additions & 16 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,34 @@


def pytest_addoption(parser):
"""adds a cli option to pytest
"""
parser.addoption('--vpn', action='store_true', default=False, help='run tests that require vpn')
parser.addoption('--google', action='store_true', default=False, help='run tests that require google sheets access')
"""adds a cli option to pytest"""
parser.addoption("--vpn", action="store_true", default=False, help="run tests that require vpn")
parser.addoption(
"--google",
action="store_true",
default=False,
help="run tests that require google sheets access",
)


def pytest_configure(config):
"""setup configuration on pytest
"""
config.addinivalue_line('markers', 'vpn: mark test as vpn required to run')
config.addinivalue_line('markers', 'google: mark test as google required to run')
"""setup configuration on pytest"""
config.addinivalue_line("markers", "vpn: mark test as vpn required to run")
config.addinivalue_line("markers", "google: mark test as google required to run")


def pytest_collection_modifyitems(config, items):
"""modify test collection to handle marked tests
"""
if not config.getoption('--vpn'):
skip_vpn = pytest.mark.skip(reason='need --vpn option to run on state network')
"""modify test collection to handle marked tests"""
if not config.getoption("--vpn"):
skip_vpn = pytest.mark.skip(reason="need --vpn option to run on state network")

for item in items:
if 'vpn' in item.keywords:
if "vpn" in item.keywords:
item.add_marker(skip_vpn)

if not config.getoption('--google'):
skip_google = pytest.mark.skip(reason='need --google option and client-secrets.json to access')
if not config.getoption("--google"):
skip_google = pytest.mark.skip(reason="need --google option and client-secrets.json to access")

for item in items:
if 'google' in item.keywords:
if "google" in item.keywords:
item.add_marker(skip_google)
Loading

0 comments on commit 418eab3

Please sign in to comment.