Skip to content

Commit

Permalink
Pytest email
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Jun 10, 2023
1 parent 5c64e5f commit e81d4a0
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions drms/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

import pytest

import drms

# Test URLs, used to check if a online site is reachable
jsoc_testurl = "http://jsoc.stanford.edu/"
kis_testurl = "http://drms.leibniz-kis.de/"
Expand Down Expand Up @@ -67,14 +65,21 @@ def email(request):
"""
Email address from --email command line option.
"""
return request.config.getoption("--email")
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


@pytest.fixture
def jsoc_client():
"""
Client fixture for JSOC online tests, does not use email.
"""
import drms

return drms.Client("jsoc")


Expand All @@ -83,6 +88,8 @@ def jsoc_client_export(email):
"""
Client fixture for JSOC online tests, uses email if specified.
"""
import drms

return drms.Client("jsoc", email=email)


Expand All @@ -91,4 +98,6 @@ def kis_client():
"""
Client fixture for KIS online tests.
"""
import drms

return drms.Client("kis")

0 comments on commit e81d4a0

Please sign in to comment.