Skip to content

[BUG]: test_dg_0_data fails when VTXWriter (adios2) is not available #3995

@drew-parsons

Description

@drew-parsons

Summarize the issue

VTXWriter is optional (adios2 does not support 32-bit systems for instance).
PR #3375 introduced DG0 support tested by test_dg_0_data.

The test checks if adios2 is available, skips if it is not, but only after trying to import VTXWriter. i.e. the test fails (is not skipped) when adios2 (and therefore VTXWriter) is not available.

The skip check for adios2 should be performed before importing VTXWriter.

How to reproduce the bug

pytest-3 -k test_dg_0_data test/unit/io/test_adios2.py

Minimal Example (Python)

Output (Python)

____________________________ TestVTX.test_dg_0_data ____________________________

self = <test_adios2.TestVTX object at 0xeb8f2c38>
tempdir = '/build/reproducible-path/fenics-dolfinx-0.10.0.post2/.pybuild/cpython3_3.13_dolfinx-real/build/test/unit/io/test_adios2_tempdir_master/test_dg_0_data__1'

    def test_dg_0_data(self, tempdir):
        """Test that we can mix DG-0 and other Lagrange functions."""
>       from dolfinx.io import VTXWriter
E       ImportError: cannot import name 'VTXWriter' from 'dolfinx.io' (/build/reproducible-path/fenics-dolfinx-0.10.0.post2/.pybuild/cpython3_3.13_dolfinx-real/build/dolfinx/io/__init__.py)

test/unit/io/test_adios2.py:255: ImportError

Version

main branch

DOLFINx git commit

No response

Installation

No response

Additional information

No response

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