Skip to content

Commit d9f0597

Browse files
committed
deprecate pytest asdf
1 parent c6b24a5 commit d9f0597

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

pytest_asdf/plugin.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1+
import importlib
2+
import io
13
import os
24
import pathlib
5+
import warnings
36
from dataclasses import dataclass
47

58
import pytest
69
import yaml
710

811
# Avoid all imports of asdf at this level in order to avoid circular imports
12+
HAS_NEW_PLUGIN = importlib.util.find_spec("pytest_asdf_plugin") is not None
913

1014

1115
def pytest_addoption(parser):
16+
if HAS_NEW_PLUGIN:
17+
return
1218
parser.addini("asdf_schema_root", "Root path indicating where schemas are stored")
1319
parser.addini("asdf_schema_skip_names", "Base names of files to skip in schema tests")
1420
parser.addini(
@@ -200,6 +206,9 @@ def runtest(self):
200206
import asdf
201207
from asdf.testing.helpers import yaml_to_asdf
202208

209+
# warn inside test
210+
warnings.warn("pytest_asdf is deprecated, install pytest_asdf_plugin instead", DeprecationWarning)
211+
203212
# check the example is valid
204213
buff = yaml_to_asdf("example: " + self.example.example.strip(), version=self.example.version)
205214
tagged_tree = asdf.util.load_yaml(buff, tagged=True)
@@ -233,6 +242,8 @@ def _parse_test_list(content):
233242

234243

235244
def pytest_collect_file(file_path, parent):
245+
if HAS_NEW_PLUGIN:
246+
return None
236247
if not (parent.config.getini("asdf_schema_tests_enabled") or parent.config.getoption("asdf_tests")):
237248
return None
238249

0 commit comments

Comments
 (0)