File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import importlib
12import os
23import pathlib
34from dataclasses import dataclass
67import yaml
78
89# Avoid all imports of asdf at this level in order to avoid circular imports
10+ HAS_NEW_PLUGIN = importlib .util .find_spec ("pytest_asdf_plugin" ) is not None
911
1012
1113def pytest_addoption (parser ):
14+ if HAS_NEW_PLUGIN :
15+ return
1216 parser .addini ("asdf_schema_root" , "Root path indicating where schemas are stored" )
1317 parser .addini ("asdf_schema_skip_names" , "Base names of files to skip in schema tests" )
1418 parser .addini (
@@ -200,6 +204,9 @@ def runtest(self):
200204 import asdf
201205 from asdf .testing .helpers import yaml_to_asdf
202206
207+ # warn inside test, we don't do this yet to allow time for downstream packages to adopt pytest-asdf-plugin
208+ # warnings.warn("pytest_asdf is deprecated, install pytest_asdf_plugin instead", DeprecationWarning)
209+
203210 # check the example is valid
204211 buff = yaml_to_asdf ("example: " + self .example .example .strip (), version = self .example .version )
205212 tagged_tree = asdf .util .load_yaml (buff , tagged = True )
@@ -233,6 +240,8 @@ def _parse_test_list(content):
233240
234241
235242def pytest_collect_file (file_path , parent ):
243+ if HAS_NEW_PLUGIN :
244+ return None
236245 if not (parent .config .getini ("asdf_schema_tests_enabled" ) or parent .config .getoption ("asdf_tests" )):
237246 return None
238247
You can’t perform that action at this time.
0 commit comments