Skip to content

Commit

Permalink
Set env var for torax sim no compile test in test.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 686089551
  • Loading branch information
Nush395 authored and Torax team committed Oct 15, 2024
1 parent 3529bd3 commit 12acc05
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions torax/tests/sim_no_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

"""Tests that TORAX can be run with compilation disabled."""

import copy
import os
from typing import Optional, Sequence

from absl.testing import absltest
Expand All @@ -28,6 +30,17 @@
class SimTest(sim_test_case.SimTestCase):
"""No-compilation integration tests for torax.sim."""

def setUp(self):
self.original_flag = copy.deepcopy(os.environ)
compilation_flag = os.environ.get('TORAX_COMPILATION_ENABLED', None)
if compilation_flag is None or compilation_flag in ['1', 'True', 'true']:
os.environ['TORAX_COMPILATION_ENABLED'] = 'False'
super().setUp()

def tearDown(self):
os.environ = self.original_flag
super().tearDown()

@parameterized.named_parameters(
(
'test_implicit_optimizer_no_compile',
Expand Down

0 comments on commit 12acc05

Please sign in to comment.