-
Notifications
You must be signed in to change notification settings - Fork 3
/
conftest.py
37 lines (27 loc) · 1.09 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import inspect
from typing import Any
import pytest
def pytest_addoption(parser: Any) -> None:
parser.addoption("--use-ssh", action="store_true", help="do SSH tests")
def pytest_configure(config: Any) -> None:
config.addinivalue_line("markers", "ssh: mark test as using SSH")
def pytest_collection_modifyitems(config: Any, items: Any) -> None:
# add asyncio decorator to all async methods
for item in items:
if inspect.iscoroutinefunction(item.function):
item.add_marker(pytest.mark.asyncio)
# do SSH tests?
if not config.getoption("--use-ssh"):
nossh = pytest.mark.skip(reason="SSH testing disabled (use --use-ssh to activate.")
for item in items:
if "ssh" in item.keywords:
item.add_marker(nossh)
@pytest.fixture(scope="session", autouse=True)
def download_IERS() -> None:
# IERS workaround...
from astropy.utils import iers
from astropy.utils.data import clear_download_cache
clear_download_cache()
# iers.conf.auto_download = False
# iers.conf.auto_max_age = None
iers.IERS_Auto.open()