From 570c75811e6fb0ed6871c5487a496040ac349296 Mon Sep 17 00:00:00 2001 From: Brett Date: Tue, 16 Jan 2024 16:36:08 -0500 Subject: [PATCH] add with_lazy_tree fixture, use for several tests --- asdf/_tests/conftest.py | 7 +++++++ asdf/_tests/test_extension.py | 2 +- asdf/_tests/test_types.py | 2 +- asdf/_tests/test_yaml.py | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/asdf/_tests/conftest.py b/asdf/_tests/conftest.py index 251276217..fc8ca794c 100644 --- a/asdf/_tests/conftest.py +++ b/asdf/_tests/conftest.py @@ -64,3 +64,10 @@ def rhttpserver(request): server = RangeHTTPServer() yield server server.finalize() + + +@pytest.fixture(params=[True, False], ids=["lazy", "not-lazy"]) +def with_lazy_tree(request): + with config.config_context() as cfg: + cfg.lazy_tree = request.param + yield diff --git a/asdf/_tests/test_extension.py b/asdf/_tests/test_extension.py index be6efdcbd..24aaa539c 100644 --- a/asdf/_tests/test_extension.py +++ b/asdf/_tests/test_extension.py @@ -898,7 +898,7 @@ def from_yaml_tree(self, node, tag, ctx): config.add_extension(extension) -def test_reference_cycle(tmp_path): +def test_reference_cycle(tmp_path, with_lazy_tree): class FractionWithInverse(fractions.Fraction): def __init__(self, *args, **kwargs): self._inverse = None diff --git a/asdf/_tests/test_types.py b/asdf/_tests/test_types.py index 11cbacf70..83d08fd87 100644 --- a/asdf/_tests/test_types.py +++ b/asdf/_tests/test_types.py @@ -6,7 +6,7 @@ from . import _helpers as helpers -def test_undefined_tag(): +def test_undefined_tag(with_lazy_tree): # This tests makes sure that ASDF still returns meaningful structured data # even when it encounters a schema tag that it does not specifically # implement as an extension diff --git a/asdf/_tests/test_yaml.py b/asdf/_tests/test_yaml.py index a4f9f7e31..004b421ce 100644 --- a/asdf/_tests/test_yaml.py +++ b/asdf/_tests/test_yaml.py @@ -13,7 +13,7 @@ from . import _helpers as helpers -def test_ordered_dict(tmp_path): +def test_ordered_dict(tmp_path, with_lazy_tree): """ Test that we can write out and read in ordered dicts. """