def test_xla_strategy_debug_state():
    """Tests if device/debug flag is set correctly when training and after teardown for XLAStrategy."""
    model = BoringModelTPU()
    trainer = Trainer(fast_dev_run=True, strategy=XLAStrategy(debug=True))
    assert isinstance(trainer.accelerator, XLAAccelerator)
    assert isinstance(trainer.strategy, XLAStrategy)
    trainer.fit(model)
    assert "PT_XLA_DEBUG" not in os.environ
Tests if device/debug flag is set correctly when training and after teardown for XLAStrategy.
tests/tests_pytorch/strategies/test_xla.py