Skip to content

Commit

Permalink
Only call continue_annotation once in test so stop_annotating works a…
Browse files Browse the repository at this point in the history
…s expected
  • Loading branch information
connorjward committed Nov 17, 2022
1 parent 7e13000 commit 61cb5f2
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions tests/vertexonly/test_poisson_inverse_conductivity.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import numpy as np
from firedrake import *
from pyadjoint.tape import get_working_tape, pause_annotation, continue_annotation, set_working_tape
from pyadjoint.tape import get_working_tape, pause_annotation


@pytest.fixture(autouse=True)
Expand Down Expand Up @@ -29,12 +29,6 @@ def test_poisson_inverse_conductivity():
# Have to import inside test to make sure cleanup fixtures work as intended
from firedrake_adjoint import Control, ReducedFunctional, minimize

# Manually set up annotation since test suite may have stopped it
tape = get_working_tape()
tape.clear_tape()
set_working_tape(tape)
continue_annotation()

# Use pyadjoint to estimate an unknown conductivity in a
# poisson-like forward model from point measurements
m = UnitSquareMesh(2, 2)
Expand Down Expand Up @@ -98,7 +92,3 @@ def test_poisson_inverse_conductivity():

# Estimate q using Newton-CG which evaluates the hessian action
minimize(, method='Newton-CG', options={'disp': True})

# Make sure annotation is stopped
tape.clear_tape()
pause_annotation()

0 comments on commit 61cb5f2

Please sign in to comment.