2929import yaml
3030from lightning_utilities import compare_version
3131from lightning_utilities .test .warning import no_warning_call
32- from packaging .version import Version
3332from tensorboard .backend .event_processing import event_accumulator
3433from tensorboard .plugins .hparams .plugin_data_pb2 import HParamsPluginData
3534from torch .optim import SGD
@@ -65,14 +64,6 @@ def lazy_instance(*args, **kwargs):
6564 return None
6665
6766
68- _xfail_python_ge_3_11_9 = pytest .mark .xfail (
69- # https://github.com/omni-us/jsonargparse/issues/484
70- Version (f"{ sys .version_info .major } .{ sys .version_info .minor } .{ sys .version_info .micro } " ) >= Version ("3.11.9" ),
71- strict = False ,
72- reason = "jsonargparse + Python 3.11.9 compatibility issue" ,
73- )
74-
75-
7667@contextmanager
7768def mock_subclasses (baseclass , * subclasses ):
7869 """Mocks baseclass so that it only has the given child subclasses."""
@@ -356,7 +347,6 @@ def test_save_to_log_dir_false_error():
356347 )
357348
358349
359- @_xfail_python_ge_3_11_9
360350def test_lightning_cli_logger_save_config (cleandir ):
361351 class LoggerSaveConfigCallback (SaveConfigCallback ):
362352 def __init__ (self , * args , ** kwargs ) -> None :
@@ -753,7 +743,6 @@ def add_arguments_to_parser(self, parser):
753743 assert cli .trainer .lr_scheduler_configs [0 ].scheduler .step_size == 50
754744
755745
756- @_xfail_python_ge_3_11_9
757746@RunIf (min_torch = "2.2" )
758747@pytest .mark .parametrize ("use_generic_base_class" , [False , True ])
759748def test_lightning_cli_optimizers_and_lr_scheduler_with_link_to (use_generic_base_class ):
@@ -801,7 +790,6 @@ def __init__(self, optim1: dict, optim2: dict, scheduler: dict):
801790 assert isinstance (cli .model .scheduler , torch .optim .lr_scheduler .ExponentialLR )
802791
803792
804- @_xfail_python_ge_3_11_9
805793@RunIf (min_torch = "2.2" )
806794def test_lightning_cli_optimizers_and_lr_scheduler_with_callable_type ():
807795 class TestModel (BoringModel ):
@@ -1118,7 +1106,6 @@ def __init__(self, foo, bar=5):
11181106 self .bar = bar
11191107
11201108
1121- @_xfail_python_ge_3_11_9
11221109def test_lightning_cli_model_short_arguments ():
11231110 with (
11241111 mock .patch ("sys.argv" , ["any.py" , "fit" , "--model=BoringModel" ]),
@@ -1146,7 +1133,6 @@ def __init__(self, foo, bar=5):
11461133 self .bar = bar
11471134
11481135
1149- @_xfail_python_ge_3_11_9
11501136def test_lightning_cli_datamodule_short_arguments ():
11511137 # with set model
11521138 with (
@@ -1200,7 +1186,6 @@ def test_lightning_cli_datamodule_short_arguments():
12001186 assert cli .parser .groups ["data" ].group_class is BoringDataModule
12011187
12021188
1203- @_xfail_python_ge_3_11_9
12041189@pytest .mark .parametrize ("use_class_path_callbacks" , [False , True ])
12051190def test_callbacks_append (use_class_path_callbacks ):
12061191 """This test validates registries are used when simplified command line are being used."""
@@ -1244,7 +1229,6 @@ def test_callbacks_append(use_class_path_callbacks):
12441229 assert all (t in callback_types for t in expected )
12451230
12461231
1247- @_xfail_python_ge_3_11_9
12481232def test_optimizers_and_lr_schedulers_reload (cleandir ):
12491233 base = ["any.py" , "--trainer.max_epochs=1" ]
12501234 input = base + [
@@ -1276,7 +1260,6 @@ def test_optimizers_and_lr_schedulers_reload(cleandir):
12761260 LightningCLI (BoringModel , run = False )
12771261
12781262
1279- @_xfail_python_ge_3_11_9
12801263def test_optimizers_and_lr_schedulers_add_arguments_to_parser_implemented_reload (cleandir ):
12811264 class TestLightningCLI (LightningCLI ):
12821265 def __init__ (self , * args ):
@@ -1540,7 +1523,6 @@ def test_cli_help_message():
15401523 assert "Implements Adam" in shorthand_help .getvalue ()
15411524
15421525
1543- @_xfail_python_ge_3_11_9
15441526def test_cli_reducelronplateau ():
15451527 with mock .patch (
15461528 "sys.argv" , ["any.py" , "--optimizer=Adam" , "--lr_scheduler=ReduceLROnPlateau" , "--lr_scheduler.monitor=foo" ]
@@ -1551,7 +1533,6 @@ def test_cli_reducelronplateau():
15511533 assert config ["lr_scheduler" ]["scheduler" ].monitor == "foo"
15521534
15531535
1554- @_xfail_python_ge_3_11_9
15551536def test_cli_configureoptimizers_can_be_overridden ():
15561537 class MyCLI (LightningCLI ):
15571538 def __init__ (self ):
@@ -1596,7 +1577,6 @@ def __init__(self, activation: torch.nn.Module = lazy_instance(torch.nn.LeakyReL
15961577 assert cli .model .activation is not model .activation
15971578
15981579
1599- @_xfail_python_ge_3_11_9
16001580def test_ddpstrategy_instantiation_and_find_unused_parameters (mps_count_0 ):
16011581 strategy_default = lazy_instance (DDPStrategy , find_unused_parameters = True )
16021582 with mock .patch ("sys.argv" , ["any.py" , "--trainer.strategy.process_group_backend=group" ]):
@@ -1612,7 +1592,6 @@ def test_ddpstrategy_instantiation_and_find_unused_parameters(mps_count_0):
16121592 assert strategy_default is not cli .config_init .trainer .strategy
16131593
16141594
1615- @_xfail_python_ge_3_11_9
16161595def test_cli_logger_shorthand ():
16171596 with mock .patch ("sys.argv" , ["any.py" ]):
16181597 cli = LightningCLI (TestModel , run = False , trainer_defaults = {"logger" : False })
@@ -1643,7 +1622,6 @@ def _test_logger_init_args(logger_name, init, unresolved=None):
16431622 assert data ["dict_kwargs" ] == unresolved
16441623
16451624
1646- @_xfail_python_ge_3_11_9
16471625def test_comet_logger_init_args ():
16481626 _test_logger_init_args (
16491627 "CometLogger" ,
@@ -1664,7 +1642,6 @@ def test_comet_logger_init_args():
16641642 strict = False ,
16651643 reason = "TypeError on Windows when parsing" ,
16661644)
1667- @_xfail_python_ge_3_11_9
16681645def test_neptune_logger_init_args ():
16691646 _test_logger_init_args (
16701647 "NeptuneLogger" ,
@@ -1673,7 +1650,6 @@ def test_neptune_logger_init_args():
16731650 )
16741651
16751652
1676- @_xfail_python_ge_3_11_9
16771653def test_tensorboard_logger_init_args ():
16781654 _test_logger_init_args (
16791655 "TensorBoardLogger" ,
@@ -1685,7 +1661,6 @@ def test_tensorboard_logger_init_args():
16851661 )
16861662
16871663
1688- @_xfail_python_ge_3_11_9
16891664def test_wandb_logger_init_args ():
16901665 _test_logger_init_args (
16911666 "WandbLogger" ,
@@ -1770,7 +1745,6 @@ def __init__(self, a_func: Callable = torch.nn.Softmax):
17701745 assert "a_func: torch.nn.Softmax" in out .getvalue ()
17711746
17721747
1773- @_xfail_python_ge_3_11_9
17741748def test_pytorch_profiler_init_args ():
17751749 from lightning .pytorch .profilers import Profiler , PyTorchProfiler
17761750
0 commit comments