File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
tests_fabric/plugins/precision
tests_pytorch/plugins/precision Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 2222from tests_fabric .helpers .runif import RunIf
2323
2424
25+ # Pytest passes args/kwargs to the context manager used with `pytest.warns`.
26+ # `contextlib.nullcontext` doesn't accept them, so this no-op version does.
2527@contextmanager
26- def null_ctx_manager (* args , ** kwargs ):
28+ def null_ctx (* args , ** kwargs ):
2729 yield
2830
2931
@@ -40,7 +42,7 @@ def null_ctx_manager(*args, **kwargs):
4042def test_fsdp_precision_config (precision , expected ):
4143 plugin = FSDPPrecision (precision = precision )
4244
43- warning_ctx = pytest .warns if precision in ("16-true" , "bf16-true" ) else null_ctx_manager
45+ warning_ctx = pytest .warns if precision in ("16-true" , "bf16-true" ) else null_ctx
4446
4547 with warning_ctx (UserWarning , match = "enables mixed-precision execution" ):
4648 config = plugin .mixed_precision_config
Original file line number Diff line number Diff line change 2222from tests_pytorch .helpers .runif import RunIf
2323
2424
25+ # Pytest passes args/kwargs to the context manager used with `pytest.warns`.
26+ # `contextlib.nullcontext` doesn't accept them, so this no-op version does.
2527@contextmanager
26- def null_ctx_manager (* args , ** kwargs ):
28+ def null_ctx (* args , ** kwargs ):
2729 yield
2830
2931
@@ -40,7 +42,7 @@ def null_ctx_manager(*args, **kwargs):
4042def test_fsdp_precision_config (precision , expected ):
4143 plugin = FSDPPrecision (precision = precision )
4244
43- warning_ctx = pytest .warns if precision in ("16-true" , "bf16-true" ) else null_ctx_manager
45+ warning_ctx = pytest .warns if precision in ("16-true" , "bf16-true" ) else null_ctx
4446
4547 with warning_ctx (UserWarning , match = "enables mixed-precision execution" ):
4648 config = plugin .mixed_precision_config
You can’t perform that action at this time.
0 commit comments