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
2+ import io
13import os
24import pathlib
5+ import warnings
36from dataclasses import dataclass
47
58import pytest
69import 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
1115def 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
235244def 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
You can’t perform that action at this time.
0 commit comments