| 1 |
import pytest |
| 2 |
import gc |
| 3 |
from dolfin import MPI |
| 4 |
|
| 5 |
def pytest_runtest_teardown(item): |
| 6 |
"""Collect garbage after every test to force calling |
| 7 |
destructors which might be collective""" |
| 8 |
|
| 9 |
# Do the normal teardown |
| 10 |
item.teardown() |
| 11 |
|
| 12 |
# Collect the garbage (call destructors collectively) |
| 13 |
del item |
| 14 |
# NOTE: How are we sure that 'item' does not hold references |
| 15 |
# to temporaries and someone else does not hold a reference |
| 16 |
# to 'item'?! Well, it seems that it works... |
| 17 |
gc.collect() |
| 18 |
MPI.barrier(MPI.comm_world) |