Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/firedrake/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
os.environ["FIREDRAKE_DISABLE_OPTIONS_LEFT"] = "1"

import pytest
from mpi4py import MPI
from petsctools import get_external_packages
from pyadjoint.tape import (
annotate_tape, get_working_tape, set_working_tape,
Expand Down Expand Up @@ -256,3 +257,10 @@ def __exit__(self, exc_type, exc_val, traceback):
def petsc_raises():
# This function is needed because pytest does not support classes as fixtures.
return _petsc_raises


@pytest.fixture
def garbage_cleanup():
"""Fixture that runs the parallel garbage collector."""
yield
PETSc.garbage_cleanup(MPI.COMM_WORLD)
5 changes: 5 additions & 0 deletions tests/firedrake/output/test_io_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
func_name = "f"


@pytest.fixture(autouse=True)
def autouse_garbage_cleanup(garbage_cleanup):
pass


def _initialise_function(f, _f, method):
if method == "project":
getattr(f, method)(_f, solver_parameters={"ksp_type": "cg", "pc_type": "sor", "ksp_rtol": 1.e-16})
Expand Down
2 changes: 1 addition & 1 deletion tests/firedrake/regression/test_covariance_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def rng():
@pytest.mark.parametrize("family", ("CG", "DG"))
@pytest.mark.parametrize("mesh_type", ("interval", "square"))
@pytest.mark.parametrize("backend_type", (PyOP2NoiseBackend, PetscNoiseBackend), ids=("pyop2", "petsc"))
def test_white_noise(family, degree, mesh_type, dim, backend_type, rng):
def test_white_noise(family, degree, mesh_type, dim, backend_type, rng, garbage_cleanup):
"""Test that white noise generator converges to a mass matrix covariance.
"""

Expand Down
Loading