Skip to content

PseudoNetCDF tests failing randomly #3711

Closed
@keewis

Description

@keewis

The py37-windows CI seems to fail for newer PRs:

_______________ TestPseudoNetCDFFormat.test_uamiv_format_write ________________

self = <xarray.tests.test_backends.TestPseudoNetCDFFormat object at 0x000002E11FF2DC08>

    def	test_uamiv_format_write(self):
	fmtkw =	{"format": "uamiv"}

	expected = open_example_dataset(
            "example.uamiv", engine="pseudonetcdf", backend_kwargs=fmtkw
	)
	with self.roundtrip(
	    expected,
            save_kwargs=fmtkw,
	    open_kwargs={"backend_kwargs": fmtkw},
            allow_cleanup_failure=True,
	) as actual:
>           assert_identical(expected, actual)

xarray\tests\test_backends.py:3532:
_ _ _ _	_ _ _ _	_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _	_ _ _ _	_ _ _ _	_ _ _ _	_ _ _ _
xarray\core\formatting.py:628: in diff_dataset_repr
    summary.append(diff_attrs_repr(a.attrs, b.attrs, compat))
_ _ _ _	_ _ _ _	_ _ _ _	_ _ _ _	_ _ _ _	_ _ _ _	_ _ _ _	_ _ _ _	_ _ _ _	_ _ _ _

a_mapping = {'CPROJ': 0, 'FILEDESC': 'CAMx            ', 'FTYPE': 1, 'GDNAM': 'CAMx            ', ...}
b_mapping = {'CPROJ': 0, 'FILEDESC': 'CAMx            ', 'FTYPE': 1, 'GDNAM': 'CAMx            ', ...}
compat = 'identical', title = 'Attributes'
summarizer = <function summarize_attr at 0x000002E1156813A8>, col_width = None

    def _diff_mapping_repr(a_mapping, b_mapping, compat, title, summarizer, col_width=None):
        def extra_items_repr(extra_keys, mapping, ab_side):
            extra_repr = [summarizer(k, mapping[k], col_width) for k in extra_keys]
            if extra_repr:
                header = f"{title} only on the {ab_side} object:"
                return [header] + extra_repr
            else:
                return []

	a_keys = set(a_mapping)
        b_keys = set(b_mapping)

        summary = []

	diff_items = []

        for k in a_keys & b_keys:
	    try:
                # compare xarray variable
                compatible = getattr(a_mapping[k], compat)(b_mapping[k])
                is_variable = True
            except AttributeError:
                # compare attribute value
                compatible = a_mapping[k] == b_mapping[k]
                is_variable = False

>           if not compatible:
E           ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions