From 3f9ca4b525ff3504486952b8f9f11649f2bd19d1 Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Fri, 9 Jun 2023 17:28:11 -0700 Subject: [PATCH] Unsure hack --- drms/{ => tests}/conftest.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) rename drms/{ => tests}/conftest.py (86%) diff --git a/drms/conftest.py b/drms/tests/conftest.py similarity index 86% rename from drms/conftest.py rename to drms/tests/conftest.py index 0247aa8..1ac3fb2 100644 --- a/drms/conftest.py +++ b/drms/tests/conftest.py @@ -9,7 +9,7 @@ def pytest_addoption(parser): - parser.addoption("--email", help="Export email address") + parser.addoption("--email", action="store", help="Export email address") class lazily_cached: @@ -55,7 +55,7 @@ def pytest_runtest_setup(item): # Skip export tests if no email address was specified. if item.get_closest_marker("export") is not None: - email = item.config.getoption("email") + email = item.config.getoption("email", None) if email is None: pytest.skip("No email address specified; use the --email option to enable export tests") @@ -65,12 +65,7 @@ def email(request): """ Email address from --email command line option. """ - try: - getattr(request.config, "email") - except AttributeError: - pytest.skip("No email address specified; use the --email option to enable export tests") - email = request.config.getoption("--email") - return email + return request.config.getoption("--email", None) @pytest.fixture