From d5b37e9e33b59098db615189b48c0dd5fd52244a Mon Sep 17 00:00:00 2001 From: Jirka Date: Wed, 1 Jun 2022 15:05:16 +0200 Subject: [PATCH] rename unittests --- pyproject.toml | 4 ++-- test/tests/helpers/__init__.py | 7 ------- test/{tests => unittests}/__init__.py | 0 test/{tests => unittests}/accelerators/__init__.py | 0 .../accelerators/test_accelerator_connector.py | 2 +- .../accelerators/test_accelerator_registry.py | 0 .../accelerators/test_common.py | 0 test/{tests => unittests}/accelerators/test_cpu.py | 2 +- test/{tests => unittests}/accelerators/test_gpu.py | 4 ++-- test/{tests => unittests}/accelerators/test_hpu.py | 8 ++++---- test/{tests => unittests}/accelerators/test_ipu.py | 8 ++++---- test/{tests => unittests}/accelerators/test_tpu.py | 6 +++--- test/{tests => unittests}/benchmarks/__init__.py | 0 .../benchmarks/generate_comparison.py | 4 ++-- .../benchmarks/test_basic_parity.py | 2 +- .../benchmarks/test_sharded_parity.py | 4 ++-- .../benchmarks/test_sync_batchnorm_parity.py | 2 +- test/{tests => unittests}/callbacks/__init__.py | 0 .../callbacks/test_callback_hook_outputs.py | 2 +- .../callbacks/test_callbacks.py | 4 ++-- .../callbacks/test_device_stats_monitor.py | 4 ++-- .../callbacks/test_early_stopping.py | 8 ++++---- .../callbacks/test_finetuning_callback.py | 2 +- .../test_gradient_accumulation_scheduler.py | 2 +- .../callbacks/test_lambda_function.py | 4 ++-- .../callbacks/test_lr_monitor.py | 8 ++++---- .../callbacks/test_model_summary.py | 2 +- .../callbacks/test_prediction_writer.py | 4 ++-- .../{tests => unittests}/callbacks/test_pruning.py | 4 ++-- .../callbacks/test_quantization.py | 8 ++++---- .../callbacks/test_rich_model_summary.py | 4 ++-- .../callbacks/test_rich_progress_bar.py | 4 ++-- .../callbacks/test_stochastic_weight_avg.py | 4 ++-- test/{tests => unittests}/callbacks/test_timer.py | 4 ++-- .../callbacks/test_tqdm_progress_bar.py | 4 ++-- .../{tests => unittests}/checkpointing/__init__.py | 0 .../test_checkpoint_callback_frequency.py | 4 ++-- .../checkpointing/test_legacy_checkpoints.py | 2 +- .../checkpointing/test_model_checkpoint.py | 6 +++--- .../checkpointing/test_torch_saving.py | 4 ++-- .../checkpointing/test_trainer_checkpoint.py | 2 +- test/{tests => unittests}/conftest.py | 2 +- test/{tests => unittests}/core/__init__.py | 0 test/{tests => unittests}/core/test_datamodules.py | 10 +++++----- .../core/test_lightning_module.py | 4 ++-- .../core/test_lightning_optimizer.py | 2 +- .../core/test_metric_result_integration.py | 6 +++--- test/{tests => unittests}/core/test_results.py | 4 ++-- .../deprecated_api/__init__.py | 2 +- .../deprecated_api/test_remove_1-7.py | 6 +++--- .../deprecated_api/test_remove_1-8.py | 8 ++++---- .../deprecated_api/test_remove_1-9.py | 0 .../deprecated_api/test_remove_2-0.py | 4 ++-- test/unittests/helpers/__init__.py | 7 +++++++ .../helpers/advanced_models.py | 4 ++-- test/{tests => unittests}/helpers/boring_model.py | 0 test/{tests => unittests}/helpers/dataloaders.py | 0 test/{tests => unittests}/helpers/datamodules.py | 2 +- test/{tests => unittests}/helpers/datasets.py | 0 .../helpers/deterministic_model.py | 0 test/{tests => unittests}/helpers/imports.py | 0 test/{tests => unittests}/helpers/pipelines.py | 4 ++-- test/{tests => unittests}/helpers/runif.py | 0 test/{tests => unittests}/helpers/simple_models.py | 0 test/{tests => unittests}/helpers/test_datasets.py | 4 ++-- test/{tests => unittests}/helpers/test_models.py | 8 ++++---- .../helpers/torchtext_utils.py | 2 +- test/{tests => unittests}/helpers/utils.py | 4 ++-- test/{tests => unittests}/lite/__init__.py | 0 test/{tests => unittests}/lite/test_lite.py | 2 +- test/{tests => unittests}/lite/test_parity.py | 4 ++-- test/{tests => unittests}/lite/test_wrappers.py | 2 +- test/{tests => unittests}/loggers/__init__.py | 0 test/{tests => unittests}/loggers/test_all.py | 12 ++++++------ test/{tests => unittests}/loggers/test_comet.py | 2 +- test/{tests => unittests}/loggers/test_csv.py | 4 ++-- test/{tests => unittests}/loggers/test_logger.py | 2 +- test/{tests => unittests}/loggers/test_mlflow.py | 2 +- test/{tests => unittests}/loggers/test_neptune.py | 2 +- .../loggers/test_tensorboard.py | 4 ++-- test/{tests => unittests}/loggers/test_wandb.py | 4 ++-- test/{tests => unittests}/loops/__init__.py | 0 test/{tests => unittests}/loops/batch/__init__.py | 0 .../loops/batch/test_truncated_bptt.py | 0 test/{tests => unittests}/loops/epoch/__init__.py | 0 .../loops/epoch/test_training_epoch_loop.py | 4 ++-- .../loops/optimization/__init__.py | 0 .../loops/optimization/test_closure.py | 2 +- .../loops/optimization/test_manual_loop.py | 2 +- .../loops/optimization/test_optimizer_loop.py | 2 +- test/{tests => unittests}/loops/test_all.py | 4 ++-- .../loops/test_evaluation_loop.py | 4 ++-- .../loops/test_evaluation_loop_flow.py | 2 +- .../loops/test_flow_warnings.py | 2 +- .../loops/test_loop_state_dict.py | 0 test/{tests => unittests}/loops/test_loops.py | 4 ++-- .../loops/test_training_loop.py | 2 +- .../loops/test_training_loop_flow_dict.py | 2 +- .../loops/test_training_loop_flow_scalar.py | 6 +++--- test/{tests => unittests}/loops/test_utilities.py | 0 test/{tests => unittests}/models/__init__.py | 0 test/{tests => unittests}/models/conf/config.yaml | 0 .../models/conf/training/default.yaml | 0 test/{tests => unittests}/models/data/__init__.py | 0 .../models/data/horovod/__init__.py | 0 .../models/data/horovod/test_train_script.py | 2 +- .../models/data/horovod/train_default_model.py | 4 ++-- test/{tests => unittests}/models/test_amp.py | 6 +++--- test/{tests => unittests}/models/test_cpu.py | 12 ++++++------ test/{tests => unittests}/models/test_gpu.py | 14 +++++++------- test/{tests => unittests}/models/test_grad_norm.py | 4 ++-- test/{tests => unittests}/models/test_hooks.py | 4 ++-- test/{tests => unittests}/models/test_horovod.py | 12 ++++++------ test/{tests => unittests}/models/test_hparams.py | 8 ++++---- test/{tests => unittests}/models/test_onnx.py | 10 +++++----- test/{tests => unittests}/models/test_restore.py | 14 +++++++------- .../models/test_torchscript.py | 6 +++--- test/{tests => unittests}/models/test_tpu.py | 10 +++++----- test/{tests => unittests}/overrides/__init__.py | 0 test/{tests => unittests}/overrides/test_base.py | 2 +- .../overrides/test_data_parallel.py | 4 ++-- .../overrides/test_distributed.py | 0 test/{tests => unittests}/plugins/__init__.py | 0 .../plugins/environments/__init__.py | 0 .../environments/test_kubeflow_environment.py | 0 .../environments/test_lightning_environment.py | 0 .../plugins/environments/test_lsf_environment.py | 0 .../plugins/environments/test_slurm_environment.py | 0 .../environments/test_torchelastic_environment.py | 2 +- .../plugins/environments/torch_elastic_deadlock.py | 2 +- .../plugins/precision/__init__.py | 0 .../plugins/precision/hpu/ops_bf16.txt | 0 .../plugins/precision/hpu/ops_fp32.txt | 0 .../plugins/precision/hpu/test_hpu.py | 4 ++-- .../plugins/precision/test_deepspeed_precision.py | 0 .../plugins/precision/test_sharded_precision.py | 2 +- .../plugins/precision/test_tpu_bf16_plugin.py | 0 .../plugins/test_amp_plugins.py | 4 ++-- .../plugins/test_checkpoint_io_plugin.py | 2 +- .../plugins/test_cluster_integration.py | 2 +- .../plugins/test_double_plugin.py | 4 ++-- test/{tests => unittests}/profiler/__init__.py | 0 .../{tests => unittests}/profiler/test_profiler.py | 4 ++-- .../profiler/test_xla_profiler.py | 4 ++-- test/{tests => unittests}/strategies/__init__.py | 0 test/{tests => unittests}/strategies/ddp_model.py | 4 ++-- .../strategies/test_bagua_strategy.py | 4 ++-- .../strategies/test_collaborative.py | 4 ++-- .../{tests => unittests}/strategies/test_common.py | 10 +++++----- .../strategies/test_custom_plugin.py | 2 +- test/{tests => unittests}/strategies/test_ddp.py | 8 ++++---- .../strategies/test_ddp_fully_sharded_native.py | 4 ++-- .../test_ddp_fully_sharded_with_full_state_dict.py | 4 ++-- .../strategies/test_ddp_spawn.py | 12 ++++++------ .../strategies/test_ddp_spawn_strategy.py | 4 ++-- .../strategies/test_ddp_strategy.py | 4 ++-- .../strategies/test_ddp_strategy_with_comm_hook.py | 4 ++-- .../strategies/test_deepspeed_strategy.py | 6 +++--- test/{tests => unittests}/strategies/test_dp.py | 12 ++++++------ .../strategies/test_sharded_strategy.py | 4 ++-- .../strategies/test_single_device_strategy.py | 4 ++-- .../strategies/test_strategy_registry.py | 2 +- .../strategies/test_tpu_spawn.py | 8 ++++---- test/{tests => unittests}/trainer/__init__.py | 0 .../trainer/connectors/__init__.py | 0 .../trainer/connectors/test_callback_connector.py | 2 +- .../connectors/test_checkpoint_connector.py | 2 +- .../trainer/connectors/test_data_connector.py | 6 +++--- .../trainer/connectors/test_signal_connector.py | 4 ++-- .../trainer/dynamic_args/__init__.py | 0 .../dynamic_args/test_multiple_eval_dataloaders.py | 2 +- .../{tests => unittests}/trainer/flags/__init__.py | 0 .../trainer/flags/test_check_val_every_n_epoch.py | 2 +- .../trainer/flags/test_env_vars.py | 0 .../trainer/flags/test_fast_dev_run.py | 2 +- .../trainer/flags/test_limit_batches.py | 2 +- .../trainer/flags/test_min_max_epochs.py | 2 +- .../trainer/flags/test_overfit_batches.py | 4 ++-- .../trainer/flags/test_val_check_interval.py | 4 ++-- .../trainer/logging_/__init__.py | 0 .../trainer/logging_/test_distributed_logging.py | 4 ++-- .../trainer/logging_/test_eval_loop_logging.py | 4 ++-- .../trainer/logging_/test_logger_connector.py | 6 +++--- .../trainer/logging_/test_loop_logging.py | 2 +- .../trainer/logging_/test_progress_bar_logging.py | 2 +- .../trainer/logging_/test_train_loop_logging.py | 4 ++-- .../trainer/optimization/__init__.py | 0 .../trainer/optimization/test_backward_calls.py | 2 +- .../optimization/test_manual_optimization.py | 4 ++-- .../optimization/test_multiple_optimizers.py | 2 +- .../trainer/optimization/test_optimizers.py | 4 ++-- .../trainer/properties/__init__.py | 0 .../trainer/properties/test_auto_gpu_select.py | 2 +- .../properties/test_estimated_stepping_batches.py | 6 +++--- .../trainer/properties/test_get_model.py | 4 ++-- .../trainer/properties/test_log_dir.py | 2 +- .../trainer/properties/test_loggers.py | 2 +- .../trainer/test_config_validator.py | 2 +- .../trainer/test_dataloaders.py | 11 ++++++++--- test/{tests => unittests}/trainer/test_progress.py | 0 test/{tests => unittests}/trainer/test_states.py | 2 +- .../trainer/test_supporters.py | 4 ++-- test/{tests => unittests}/trainer/test_trainer.py | 12 ++++++------ .../trainer/test_trainer_cli.py | 2 +- test/{tests => unittests}/tuner/__init__.py | 0 test/{tests => unittests}/tuner/test_lr_finder.py | 8 ++++---- .../tuner/test_scale_batch_size.py | 8 ++++---- test/{tests => unittests}/tuner/test_tuning.py | 2 +- test/{tests => unittests}/utilities/__init__.py | 0 test/{tests => unittests}/utilities/distributed.py | 0 .../utilities/test_all_gather_grad.py | 4 ++-- .../utilities/test_apply_func.py | 0 .../utilities/test_apply_func_torchtext.py | 4 ++-- .../utilities/test_argparse.py | 0 .../utilities/test_auto_restart.py | 6 +++--- test/{tests => unittests}/utilities/test_cli.py | 6 +++--- .../utilities/test_cloud_io.py | 0 test/{tests => unittests}/utilities/test_data.py | 4 ++-- .../utilities/test_deepspeed_collate_checkpoint.py | 4 ++-- .../utilities/test_distributed.py | 4 ++-- .../utilities/test_dtype_device_mixin.py | 4 ++-- test/{tests => unittests}/utilities/test_enums.py | 0 .../utilities/test_fetching.py | 4 ++-- .../utilities/test_finite_checks.py | 0 test/{tests => unittests}/utilities/test_grads.py | 0 .../{tests => unittests}/utilities/test_imports.py | 0 test/{tests => unittests}/utilities/test_logger.py | 0 test/{tests => unittests}/utilities/test_memory.py | 2 +- test/{tests => unittests}/utilities/test_meta.py | 4 ++-- .../utilities/test_migration.py | 0 .../utilities/test_model_helpers.py | 2 +- .../utilities/test_model_summary.py | 6 +++--- .../utilities/test_optimizer.py | 0 .../utilities/test_parameter_tying.py | 2 +- .../{tests => unittests}/utilities/test_parsing.py | 0 .../utilities/test_rank_zero.py | 0 .../utilities/test_remote_filesystem.py | 2 +- test/{tests => unittests}/utilities/test_seed.py | 0 test/{tests => unittests}/utilities/test_types.py | 0 .../utilities/test_upgrade_checkpoint.py | 0 .../utilities/test_warnings.py | 0 .../utilities/test_xla_device_utils.py | 2 +- 242 files changed, 371 insertions(+), 366 deletions(-) delete mode 100644 test/tests/helpers/__init__.py rename test/{tests => unittests}/__init__.py (100%) rename test/{tests => unittests}/accelerators/__init__.py (100%) rename test/{tests => unittests}/accelerators/test_accelerator_connector.py (99%) rename test/{tests => unittests}/accelerators/test_accelerator_registry.py (100%) rename test/{tests => unittests}/accelerators/test_common.py (100%) rename test/{tests => unittests}/accelerators/test_cpu.py (98%) rename test/{tests => unittests}/accelerators/test_gpu.py (96%) rename test/{tests => unittests}/accelerators/test_hpu.py (97%) rename test/{tests => unittests}/accelerators/test_ipu.py (99%) rename test/{tests => unittests}/accelerators/test_tpu.py (98%) rename test/{tests => unittests}/benchmarks/__init__.py (100%) rename test/{tests => unittests}/benchmarks/generate_comparison.py (93%) rename test/{tests => unittests}/benchmarks/test_basic_parity.py (98%) rename test/{tests => unittests}/benchmarks/test_sharded_parity.py (98%) rename test/{tests => unittests}/benchmarks/test_sync_batchnorm_parity.py (99%) rename test/{tests => unittests}/callbacks/__init__.py (100%) rename test/{tests => unittests}/callbacks/test_callback_hook_outputs.py (97%) rename test/{tests => unittests}/callbacks/test_callbacks.py (98%) rename test/{tests => unittests}/callbacks/test_device_stats_monitor.py (98%) rename test/{tests => unittests}/callbacks/test_early_stopping.py (98%) rename test/{tests => unittests}/callbacks/test_finetuning_callback.py (99%) rename test/{tests => unittests}/callbacks/test_gradient_accumulation_scheduler.py (98%) rename test/{tests => unittests}/callbacks/test_lambda_function.py (95%) rename test/{tests => unittests}/callbacks/test_lr_monitor.py (99%) rename test/{tests => unittests}/callbacks/test_model_summary.py (97%) rename test/{tests => unittests}/callbacks/test_prediction_writer.py (98%) rename test/{tests => unittests}/callbacks/test_pruning.py (99%) rename test/{tests => unittests}/callbacks/test_quantization.py (97%) rename test/{tests => unittests}/callbacks/test_rich_model_summary.py (96%) rename test/{tests => unittests}/callbacks/test_rich_progress_bar.py (99%) rename test/{tests => unittests}/callbacks/test_stochastic_weight_avg.py (98%) rename test/{tests => unittests}/callbacks/test_timer.py (98%) rename test/{tests => unittests}/callbacks/test_tqdm_progress_bar.py (99%) rename test/{tests => unittests}/checkpointing/__init__.py (100%) rename test/{tests => unittests}/checkpointing/test_checkpoint_callback_frequency.py (98%) rename test/{tests => unittests}/checkpointing/test_legacy_checkpoints.py (98%) rename test/{tests => unittests}/checkpointing/test_model_checkpoint.py (99%) rename test/{tests => unittests}/checkpointing/test_torch_saving.py (96%) rename test/{tests => unittests}/checkpointing/test_trainer_checkpoint.py (99%) rename test/{tests => unittests}/conftest.py (99%) rename test/{tests => unittests}/core/__init__.py (100%) rename test/{tests => unittests}/core/test_datamodules.py (98%) rename test/{tests => unittests}/core/test_lightning_module.py (99%) rename test/{tests => unittests}/core/test_lightning_optimizer.py (99%) rename test/{tests => unittests}/core/test_metric_result_integration.py (99%) rename test/{tests => unittests}/core/test_results.py (94%) rename test/{tests => unittests}/deprecated_api/__init__.py (95%) rename test/{tests => unittests}/deprecated_api/test_remove_1-7.py (97%) rename test/{tests => unittests}/deprecated_api/test_remove_1-8.py (99%) rename test/{tests => unittests}/deprecated_api/test_remove_1-9.py (100%) rename test/{tests => unittests}/deprecated_api/test_remove_2-0.py (97%) create mode 100644 test/unittests/helpers/__init__.py rename test/{tests => unittests}/helpers/advanced_models.py (98%) rename test/{tests => unittests}/helpers/boring_model.py (100%) rename test/{tests => unittests}/helpers/dataloaders.py (100%) rename test/{tests => unittests}/helpers/datamodules.py (98%) rename test/{tests => unittests}/helpers/datasets.py (100%) rename test/{tests => unittests}/helpers/deterministic_model.py (100%) rename test/{tests => unittests}/helpers/imports.py (100%) rename test/{tests => unittests}/helpers/pipelines.py (96%) rename test/{tests => unittests}/helpers/runif.py (100%) rename test/{tests => unittests}/helpers/simple_models.py (100%) rename test/{tests => unittests}/helpers/test_datasets.py (91%) rename test/{tests => unittests}/helpers/test_models.py (82%) rename test/{tests => unittests}/helpers/torchtext_utils.py (95%) rename test/{tests => unittests}/helpers/utils.py (97%) rename test/{tests => unittests}/lite/__init__.py (100%) rename test/{tests => unittests}/lite/test_lite.py (99%) rename test/{tests => unittests}/lite/test_parity.py (98%) rename test/{tests => unittests}/lite/test_wrappers.py (99%) rename test/{tests => unittests}/loggers/__init__.py (100%) rename test/{tests => unittests}/loggers/test_all.py (97%) rename test/{tests => unittests}/loggers/test_comet.py (99%) rename test/{tests => unittests}/loggers/test_csv.py (97%) rename test/{tests => unittests}/loggers/test_logger.py (99%) rename test/{tests => unittests}/loggers/test_mlflow.py (99%) rename test/{tests => unittests}/loggers/test_neptune.py (99%) rename test/{tests => unittests}/loggers/test_tensorboard.py (99%) rename test/{tests => unittests}/loggers/test_wandb.py (99%) rename test/{tests => unittests}/loops/__init__.py (100%) rename test/{tests => unittests}/loops/batch/__init__.py (100%) rename test/{tests => unittests}/loops/batch/test_truncated_bptt.py (100%) rename test/{tests => unittests}/loops/epoch/__init__.py (100%) rename test/{tests => unittests}/loops/epoch/test_training_epoch_loop.py (99%) rename test/{tests => unittests}/loops/optimization/__init__.py (100%) rename test/{tests => unittests}/loops/optimization/test_closure.py (97%) rename test/{tests => unittests}/loops/optimization/test_manual_loop.py (97%) rename test/{tests => unittests}/loops/optimization/test_optimizer_loop.py (99%) rename test/{tests => unittests}/loops/test_all.py (97%) rename test/{tests => unittests}/loops/test_evaluation_loop.py (98%) rename test/{tests => unittests}/loops/test_evaluation_loop_flow.py (99%) rename test/{tests => unittests}/loops/test_flow_warnings.py (95%) rename test/{tests => unittests}/loops/test_loop_state_dict.py (100%) rename test/{tests => unittests}/loops/test_loops.py (99%) rename test/{tests => unittests}/loops/test_training_loop.py (99%) rename test/{tests => unittests}/loops/test_training_loop_flow_dict.py (98%) rename test/{tests => unittests}/loops/test_training_loop_flow_scalar.py (98%) rename test/{tests => unittests}/loops/test_utilities.py (100%) rename test/{tests => unittests}/models/__init__.py (100%) rename test/{tests => unittests}/models/conf/config.yaml (100%) rename test/{tests => unittests}/models/conf/training/default.yaml (100%) rename test/{tests => unittests}/models/data/__init__.py (100%) rename test/{tests => unittests}/models/data/horovod/__init__.py (100%) rename test/{tests => unittests}/models/data/horovod/test_train_script.py (92%) rename test/{tests => unittests}/models/data/horovod/train_default_model.py (96%) rename test/{tests => unittests}/models/test_amp.py (98%) rename test/{tests => unittests}/models/test_cpu.py (96%) rename test/{tests => unittests}/models/test_gpu.py (96%) rename test/{tests => unittests}/models/test_grad_norm.py (97%) rename test/{tests => unittests}/models/test_hooks.py (99%) rename test/{tests => unittests}/models/test_horovod.py (98%) rename test/{tests => unittests}/models/test_hparams.py (99%) rename test/{tests => unittests}/models/test_onnx.py (95%) rename test/{tests => unittests}/models/test_restore.py (98%) rename test/{tests => unittests}/models/test_torchscript.py (97%) rename test/{tests => unittests}/models/test_tpu.py (98%) rename test/{tests => unittests}/overrides/__init__.py (100%) rename test/{tests => unittests}/overrides/test_base.py (97%) rename test/{tests => unittests}/overrides/test_data_parallel.py (98%) rename test/{tests => unittests}/overrides/test_distributed.py (100%) rename test/{tests => unittests}/plugins/__init__.py (100%) rename test/{tests => unittests}/plugins/environments/__init__.py (100%) rename test/{tests => unittests}/plugins/environments/test_kubeflow_environment.py (100%) rename test/{tests => unittests}/plugins/environments/test_lightning_environment.py (100%) rename test/{tests => unittests}/plugins/environments/test_lsf_environment.py (100%) rename test/{tests => unittests}/plugins/environments/test_slurm_environment.py (100%) rename test/{tests => unittests}/plugins/environments/test_torchelastic_environment.py (98%) rename test/{tests => unittests}/plugins/environments/torch_elastic_deadlock.py (95%) rename test/{tests => unittests}/plugins/precision/__init__.py (100%) rename test/{tests => unittests}/plugins/precision/hpu/ops_bf16.txt (100%) rename test/{tests => unittests}/plugins/precision/hpu/ops_fp32.txt (100%) rename test/{tests => unittests}/plugins/precision/hpu/test_hpu.py (97%) rename test/{tests => unittests}/plugins/precision/test_deepspeed_precision.py (100%) rename test/{tests => unittests}/plugins/precision/test_sharded_precision.py (97%) rename test/{tests => unittests}/plugins/precision/test_tpu_bf16_plugin.py (100%) rename test/{tests => unittests}/plugins/test_amp_plugins.py (99%) rename test/{tests => unittests}/plugins/test_checkpoint_io_plugin.py (98%) rename test/{tests => unittests}/plugins/test_cluster_integration.py (99%) rename test/{tests => unittests}/plugins/test_double_plugin.py (98%) rename test/{tests => unittests}/profiler/__init__.py (100%) rename test/{tests => unittests}/profiler/test_profiler.py (99%) rename test/{tests => unittests}/profiler/test_xla_profiler.py (95%) rename test/{tests => unittests}/strategies/__init__.py (100%) rename test/{tests => unittests}/strategies/ddp_model.py (93%) rename test/{tests => unittests}/strategies/test_bagua_strategy.py (97%) rename test/{tests => unittests}/strategies/test_collaborative.py (99%) rename test/{tests => unittests}/strategies/test_common.py (91%) rename test/{tests => unittests}/strategies/test_custom_plugin.py (97%) rename test/{tests => unittests}/strategies/test_ddp.py (97%) rename test/{tests => unittests}/strategies/test_ddp_fully_sharded_native.py (98%) rename test/{tests => unittests}/strategies/test_ddp_fully_sharded_with_full_state_dict.py (98%) rename test/{tests => unittests}/strategies/test_ddp_spawn.py (88%) rename test/{tests => unittests}/strategies/test_ddp_spawn_strategy.py (98%) rename test/{tests => unittests}/strategies/test_ddp_strategy.py (98%) rename test/{tests => unittests}/strategies/test_ddp_strategy_with_comm_hook.py (99%) rename test/{tests => unittests}/strategies/test_deepspeed_strategy.py (99%) rename test/{tests => unittests}/strategies/test_dp.py (95%) rename test/{tests => unittests}/strategies/test_sharded_strategy.py (99%) rename test/{tests => unittests}/strategies/test_single_device_strategy.py (96%) rename test/{tests => unittests}/strategies/test_strategy_registry.py (99%) rename test/{tests => unittests}/strategies/test_tpu_spawn.py (93%) rename test/{tests => unittests}/trainer/__init__.py (100%) rename test/{tests => unittests}/trainer/connectors/__init__.py (100%) rename test/{tests => unittests}/trainer/connectors/test_callback_connector.py (99%) rename test/{tests => unittests}/trainer/connectors/test_checkpoint_connector.py (99%) rename test/{tests => unittests}/trainer/connectors/test_data_connector.py (99%) rename test/{tests => unittests}/trainer/connectors/test_signal_connector.py (98%) rename test/{tests => unittests}/trainer/dynamic_args/__init__.py (100%) rename test/{tests => unittests}/trainer/dynamic_args/test_multiple_eval_dataloaders.py (98%) rename test/{tests => unittests}/trainer/flags/__init__.py (100%) rename test/{tests => unittests}/trainer/flags/test_check_val_every_n_epoch.py (97%) rename test/{tests => unittests}/trainer/flags/test_env_vars.py (100%) rename test/{tests => unittests}/trainer/flags/test_fast_dev_run.py (99%) rename test/{tests => unittests}/trainer/flags/test_limit_batches.py (98%) rename test/{tests => unittests}/trainer/flags/test_min_max_epochs.py (96%) rename test/{tests => unittests}/trainer/flags/test_overfit_batches.py (98%) rename test/{tests => unittests}/trainer/flags/test_val_check_interval.py (97%) rename test/{tests => unittests}/trainer/logging_/__init__.py (100%) rename test/{tests => unittests}/trainer/logging_/test_distributed_logging.py (98%) rename test/{tests => unittests}/trainer/logging_/test_eval_loop_logging.py (99%) rename test/{tests => unittests}/trainer/logging_/test_logger_connector.py (99%) rename test/{tests => unittests}/trainer/logging_/test_loop_logging.py (98%) rename test/{tests => unittests}/trainer/logging_/test_progress_bar_logging.py (94%) rename test/{tests => unittests}/trainer/logging_/test_train_loop_logging.py (99%) rename test/{tests => unittests}/trainer/optimization/__init__.py (100%) rename test/{tests => unittests}/trainer/optimization/test_backward_calls.py (97%) rename test/{tests => unittests}/trainer/optimization/test_manual_optimization.py (99%) rename test/{tests => unittests}/trainer/optimization/test_multiple_optimizers.py (99%) rename test/{tests => unittests}/trainer/optimization/test_optimizers.py (99%) rename test/{tests => unittests}/trainer/properties/__init__.py (100%) rename test/{tests => unittests}/trainer/properties/test_auto_gpu_select.py (98%) rename test/{tests => unittests}/trainer/properties/test_estimated_stepping_batches.py (97%) rename test/{tests => unittests}/trainer/properties/test_get_model.py (95%) rename test/{tests => unittests}/trainer/properties/test_log_dir.py (98%) rename test/{tests => unittests}/trainer/properties/test_loggers.py (98%) rename test/{tests => unittests}/trainer/test_config_validator.py (99%) rename test/{tests => unittests}/trainer/test_dataloaders.py (99%) rename test/{tests => unittests}/trainer/test_progress.py (100%) rename test/{tests => unittests}/trainer/test_states.py (98%) rename test/{tests => unittests}/trainer/test_supporters.py (99%) rename test/{tests => unittests}/trainer/test_trainer.py (99%) rename test/{tests => unittests}/trainer/test_trainer_cli.py (99%) rename test/{tests => unittests}/tuner/__init__.py (100%) rename test/{tests => unittests}/tuner/test_lr_finder.py (98%) rename test/{tests => unittests}/tuner/test_scale_batch_size.py (98%) rename test/{tests => unittests}/tuner/test_tuning.py (95%) rename test/{tests => unittests}/utilities/__init__.py (100%) rename test/{tests => unittests}/utilities/distributed.py (100%) rename test/{tests => unittests}/utilities/test_all_gather_grad.py (98%) rename test/{tests => unittests}/utilities/test_apply_func.py (100%) rename test/{tests => unittests}/utilities/test_apply_func_torchtext.py (94%) rename test/{tests => unittests}/utilities/test_argparse.py (100%) rename test/{tests => unittests}/utilities/test_auto_restart.py (99%) rename test/{tests => unittests}/utilities/test_cli.py (99%) rename test/{tests => unittests}/utilities/test_cloud_io.py (100%) rename test/{tests => unittests}/utilities/test_data.py (98%) rename test/{tests => unittests}/utilities/test_deepspeed_collate_checkpoint.py (95%) rename test/{tests => unittests}/utilities/test_distributed.py (94%) rename test/{tests => unittests}/utilities/test_dtype_device_mixin.py (97%) rename test/{tests => unittests}/utilities/test_enums.py (100%) rename test/{tests => unittests}/utilities/test_fetching.py (99%) rename test/{tests => unittests}/utilities/test_finite_checks.py (100%) rename test/{tests => unittests}/utilities/test_grads.py (100%) rename test/{tests => unittests}/utilities/test_imports.py (100%) rename test/{tests => unittests}/utilities/test_logger.py (100%) rename test/{tests => unittests}/utilities/test_memory.py (97%) rename test/{tests => unittests}/utilities/test_meta.py (96%) rename test/{tests => unittests}/utilities/test_migration.py (100%) rename test/{tests => unittests}/utilities/test_model_helpers.py (97%) rename test/{tests => unittests}/utilities/test_model_summary.py (98%) rename test/{tests => unittests}/utilities/test_optimizer.py (100%) rename test/{tests => unittests}/utilities/test_parameter_tying.py (98%) rename test/{tests => unittests}/utilities/test_parsing.py (100%) rename test/{tests => unittests}/utilities/test_rank_zero.py (100%) rename test/{tests => unittests}/utilities/test_remote_filesystem.py (98%) rename test/{tests => unittests}/utilities/test_seed.py (100%) rename test/{tests => unittests}/utilities/test_types.py (100%) rename test/{tests => unittests}/utilities/test_upgrade_checkpoint.py (100%) rename test/{tests => unittests}/utilities/test_warnings.py (100%) rename test/{tests => unittests}/utilities/test_xla_device_utils.py (97%) diff --git a/pyproject.toml b/pyproject.toml index ae3bc3b1cddd7..a5c9804a52c06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,10 +7,10 @@ requires = [ [tool.isort] known_first_party = [ - "docs", "pl_examples", "pytorch_lightning", - "tests", + "legacy", + "unittests", ] profile = "black" line_length = 120 diff --git a/test/tests/helpers/__init__.py b/test/tests/helpers/__init__.py deleted file mode 100644 index 13b2e588d6b8d..0000000000000 --- a/test/tests/helpers/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -from tests.helpers.boring_model import ( # noqa: F401 - BoringDataModule, - BoringModel, - ManualOptimBoringModel, - RandomDataset, -) -from tests.helpers.datasets import TrialMNIST # noqa: F401 diff --git a/test/tests/__init__.py b/test/unittests/__init__.py similarity index 100% rename from test/tests/__init__.py rename to test/unittests/__init__.py diff --git a/test/tests/accelerators/__init__.py b/test/unittests/accelerators/__init__.py similarity index 100% rename from test/tests/accelerators/__init__.py rename to test/unittests/accelerators/__init__.py diff --git a/test/tests/accelerators/test_accelerator_connector.py b/test/unittests/accelerators/test_accelerator_connector.py similarity index 99% rename from test/tests/accelerators/test_accelerator_connector.py rename to test/unittests/accelerators/test_accelerator_connector.py index e2d10e0b32551..84b6164311a93 100644 --- a/test/tests/accelerators/test_accelerator_connector.py +++ b/test/unittests/accelerators/test_accelerator_connector.py @@ -45,7 +45,7 @@ SingleDeviceStrategy, ) from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf def test_accelerator_choice_cpu(tmpdir): diff --git a/test/tests/accelerators/test_accelerator_registry.py b/test/unittests/accelerators/test_accelerator_registry.py similarity index 100% rename from test/tests/accelerators/test_accelerator_registry.py rename to test/unittests/accelerators/test_accelerator_registry.py diff --git a/test/tests/accelerators/test_common.py b/test/unittests/accelerators/test_common.py similarity index 100% rename from test/tests/accelerators/test_common.py rename to test/unittests/accelerators/test_common.py diff --git a/test/tests/accelerators/test_cpu.py b/test/unittests/accelerators/test_cpu.py similarity index 98% rename from test/tests/accelerators/test_cpu.py rename to test/unittests/accelerators/test_cpu.py index ce9f6d6b21ca9..a63f0bfb6893a 100644 --- a/test/tests/accelerators/test_cpu.py +++ b/test/unittests/accelerators/test_cpu.py @@ -12,7 +12,7 @@ from pytorch_lightning.plugins.precision.precision_plugin import PrecisionPlugin from pytorch_lightning.strategies import SingleDeviceStrategy from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel def test_restore_checkpoint_after_pre_setup_default(): diff --git a/test/tests/accelerators/test_gpu.py b/test/unittests/accelerators/test_gpu.py similarity index 96% rename from test/tests/accelerators/test_gpu.py rename to test/unittests/accelerators/test_gpu.py index 7cd944826ae55..e14a1f0771db6 100644 --- a/test/tests/accelerators/test_gpu.py +++ b/test/unittests/accelerators/test_gpu.py @@ -19,8 +19,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.accelerators import GPUAccelerator from pytorch_lightning.accelerators.gpu import get_nvidia_gpu_stats -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf @RunIf(min_cuda_gpus=1) diff --git a/test/tests/accelerators/test_hpu.py b/test/unittests/accelerators/test_hpu.py similarity index 97% rename from test/tests/accelerators/test_hpu.py rename to test/unittests/accelerators/test_hpu.py index 45483f167bf43..6b564685c83b5 100644 --- a/test/tests/accelerators/test_hpu.py +++ b/test/unittests/accelerators/test_hpu.py @@ -22,10 +22,10 @@ from pytorch_lightning.strategies.single_hpu import SingleHPUStrategy from pytorch_lightning.utilities import _HPU_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel @RunIf(hpu=True) diff --git a/test/tests/accelerators/test_ipu.py b/test/unittests/accelerators/test_ipu.py similarity index 99% rename from test/tests/accelerators/test_ipu.py rename to test/unittests/accelerators/test_ipu.py index 78d25732bfb0e..ec234c1c66aa2 100644 --- a/test/tests/accelerators/test_ipu.py +++ b/test/unittests/accelerators/test_ipu.py @@ -29,10 +29,10 @@ from pytorch_lightning.trainer.supporters import CombinedLoader from pytorch_lightning.utilities import _IPU_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel if _IPU_AVAILABLE: import poptorch diff --git a/test/tests/accelerators/test_tpu.py b/test/unittests/accelerators/test_tpu.py similarity index 98% rename from test/tests/accelerators/test_tpu.py rename to test/unittests/accelerators/test_tpu.py index 6cb87065bba64..f4d8cac0634ca 100644 --- a/test/tests/accelerators/test_tpu.py +++ b/test/unittests/accelerators/test_tpu.py @@ -26,9 +26,9 @@ from pytorch_lightning.plugins import PrecisionPlugin, TPUPrecisionPlugin, XLACheckpointIO from pytorch_lightning.strategies import DDPStrategy, TPUSpawnStrategy from pytorch_lightning.utilities import find_shared_parameters -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf -from tests.helpers.utils import pl_multi_process_test +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import pl_multi_process_test class WeightSharingModule(BoringModel): diff --git a/test/tests/benchmarks/__init__.py b/test/unittests/benchmarks/__init__.py similarity index 100% rename from test/tests/benchmarks/__init__.py rename to test/unittests/benchmarks/__init__.py diff --git a/test/tests/benchmarks/generate_comparison.py b/test/unittests/benchmarks/generate_comparison.py similarity index 93% rename from test/tests/benchmarks/generate_comparison.py rename to test/unittests/benchmarks/generate_comparison.py index 984ffdd19c163..9c413b76e3f67 100644 --- a/test/tests/benchmarks/generate_comparison.py +++ b/test/unittests/benchmarks/generate_comparison.py @@ -13,8 +13,8 @@ # limitations under the License. import os -from tests.benchmarks.test_basic_parity import measure_loops -from tests.helpers.advanced_models import ParityModuleMNIST, ParityModuleRNN +from unittests.benchmarks.test_basic_parity import measure_loops +from unittests.helpers.advanced_models import ParityModuleMNIST, ParityModuleRNN NUM_EPOCHS = 20 NUM_RUNS = 50 diff --git a/test/tests/benchmarks/test_basic_parity.py b/test/unittests/benchmarks/test_basic_parity.py similarity index 98% rename from test/tests/benchmarks/test_basic_parity.py rename to test/unittests/benchmarks/test_basic_parity.py index d893262148561..932f6d61c095a 100644 --- a/test/tests/benchmarks/test_basic_parity.py +++ b/test/unittests/benchmarks/test_basic_parity.py @@ -21,7 +21,7 @@ from tqdm import tqdm from pytorch_lightning import LightningModule, seed_everything, Trainer -from tests.helpers.advanced_models import ParityModuleCIFAR, ParityModuleMNIST, ParityModuleRNN +from unittests.helpers.advanced_models import ParityModuleCIFAR, ParityModuleMNIST, ParityModuleRNN _EXTEND_BENCHMARKS = os.getenv("PL_RUNNING_BENCHMARKS", "0") == "1" _SHORT_BENCHMARKS = not _EXTEND_BENCHMARKS diff --git a/test/tests/benchmarks/test_sharded_parity.py b/test/unittests/benchmarks/test_sharded_parity.py similarity index 98% rename from test/tests/benchmarks/test_sharded_parity.py rename to test/unittests/benchmarks/test_sharded_parity.py index 78e90bd0934cc..01ff58a282e1c 100644 --- a/test/tests/benchmarks/test_sharded_parity.py +++ b/test/unittests/benchmarks/test_sharded_parity.py @@ -20,8 +20,8 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.strategies import DDPSpawnShardedStrategy -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf class SeedTrainLoaderModel(BoringModel): diff --git a/test/tests/benchmarks/test_sync_batchnorm_parity.py b/test/unittests/benchmarks/test_sync_batchnorm_parity.py similarity index 99% rename from test/tests/benchmarks/test_sync_batchnorm_parity.py rename to test/unittests/benchmarks/test_sync_batchnorm_parity.py index f80a2a1a67eb2..8eb447ff8bd14 100644 --- a/test/tests/benchmarks/test_sync_batchnorm_parity.py +++ b/test/unittests/benchmarks/test_sync_batchnorm_parity.py @@ -17,7 +17,7 @@ from torch.utils.data import DataLoader, DistributedSampler from pytorch_lightning import LightningModule, seed_everything, Trainer -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf class SyncBNModule(LightningModule): diff --git a/test/tests/callbacks/__init__.py b/test/unittests/callbacks/__init__.py similarity index 100% rename from test/tests/callbacks/__init__.py rename to test/unittests/callbacks/__init__.py diff --git a/test/tests/callbacks/test_callback_hook_outputs.py b/test/unittests/callbacks/test_callback_hook_outputs.py similarity index 97% rename from test/tests/callbacks/test_callback_hook_outputs.py rename to test/unittests/callbacks/test_callback_hook_outputs.py index d4921a3486ec2..cc91dcece57ea 100644 --- a/test/tests/callbacks/test_callback_hook_outputs.py +++ b/test/unittests/callbacks/test_callback_hook_outputs.py @@ -14,7 +14,7 @@ import pytest from pytorch_lightning import Callback, Trainer -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel @pytest.mark.parametrize("single_cb", [False, True]) diff --git a/test/tests/callbacks/test_callbacks.py b/test/unittests/callbacks/test_callbacks.py similarity index 98% rename from test/tests/callbacks/test_callbacks.py rename to test/unittests/callbacks/test_callbacks.py index e225125d8ad45..068c3e6540b1c 100644 --- a/test/tests/callbacks/test_callbacks.py +++ b/test/unittests/callbacks/test_callbacks.py @@ -19,8 +19,8 @@ from pytorch_lightning import Callback, Trainer from pytorch_lightning.callbacks import ModelCheckpoint -from tests.helpers import BoringModel -from tests.helpers.utils import no_warning_call +from unittests.helpers import BoringModel +from unittests.helpers.utils import no_warning_call def test_callbacks_configured_in_model(tmpdir): diff --git a/test/tests/callbacks/test_device_stats_monitor.py b/test/unittests/callbacks/test_device_stats_monitor.py similarity index 98% rename from test/tests/callbacks/test_device_stats_monitor.py rename to test/unittests/callbacks/test_device_stats_monitor.py index b515af08a9417..3d22795c50255 100644 --- a/test/tests/callbacks/test_device_stats_monitor.py +++ b/test/unittests/callbacks/test_device_stats_monitor.py @@ -25,8 +25,8 @@ from pytorch_lightning.loggers import CSVLogger from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.rank_zero import rank_zero_only -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf @RunIf(min_cuda_gpus=1) diff --git a/test/tests/callbacks/test_early_stopping.py b/test/unittests/callbacks/test_early_stopping.py similarity index 98% rename from test/tests/callbacks/test_early_stopping.py rename to test/unittests/callbacks/test_early_stopping.py index 98b088d3fbb87..49cfd7988bab1 100644 --- a/test/tests/callbacks/test_early_stopping.py +++ b/test/unittests/callbacks/test_early_stopping.py @@ -26,10 +26,10 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel _logger = logging.getLogger(__name__) diff --git a/test/tests/callbacks/test_finetuning_callback.py b/test/unittests/callbacks/test_finetuning_callback.py similarity index 99% rename from test/tests/callbacks/test_finetuning_callback.py rename to test/unittests/callbacks/test_finetuning_callback.py index 3fe9460634c27..7f6847b83085a 100644 --- a/test/tests/callbacks/test_finetuning_callback.py +++ b/test/unittests/callbacks/test_finetuning_callback.py @@ -22,7 +22,7 @@ from pytorch_lightning import LightningModule, seed_everything, Trainer from pytorch_lightning.callbacks import BackboneFinetuning, BaseFinetuning, ModelCheckpoint from pytorch_lightning.utilities.imports import _TORCH_GREATER_EQUAL_1_11 -from tests.helpers import BoringModel, RandomDataset +from unittests.helpers import BoringModel, RandomDataset class TestBackboneFinetuningCallback(BackboneFinetuning): diff --git a/test/tests/callbacks/test_gradient_accumulation_scheduler.py b/test/unittests/callbacks/test_gradient_accumulation_scheduler.py similarity index 98% rename from test/tests/callbacks/test_gradient_accumulation_scheduler.py rename to test/unittests/callbacks/test_gradient_accumulation_scheduler.py index 25ce1e843b80e..1bda299a69adf 100644 --- a/test/tests/callbacks/test_gradient_accumulation_scheduler.py +++ b/test/unittests/callbacks/test_gradient_accumulation_scheduler.py @@ -19,7 +19,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import GradientAccumulationScheduler from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel +from unittests.helpers import BoringModel @pytest.mark.parametrize("accumulate_grad_batches", (1, 2, 3)) diff --git a/test/tests/callbacks/test_lambda_function.py b/test/unittests/callbacks/test_lambda_function.py similarity index 95% rename from test/tests/callbacks/test_lambda_function.py rename to test/unittests/callbacks/test_lambda_function.py index d7ad990484a51..465964e4dcb97 100644 --- a/test/tests/callbacks/test_lambda_function.py +++ b/test/unittests/callbacks/test_lambda_function.py @@ -17,8 +17,8 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.callbacks import Callback, LambdaCallback -from tests.helpers.boring_model import BoringModel -from tests.models.test_hooks import get_members +from unittests.helpers.boring_model import BoringModel +from unittests.models.test_hooks import get_members def test_lambda_call(tmpdir): diff --git a/test/tests/callbacks/test_lr_monitor.py b/test/unittests/callbacks/test_lr_monitor.py similarity index 99% rename from test/tests/callbacks/test_lr_monitor.py rename to test/unittests/callbacks/test_lr_monitor.py index 8afdcf003f604..5bc0791bee021 100644 --- a/test/tests/callbacks/test_lr_monitor.py +++ b/test/unittests/callbacks/test_lr_monitor.py @@ -15,15 +15,15 @@ import torch from torch import optim -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.callbacks import LearningRateMonitor from pytorch_lightning.callbacks.callback import Callback from pytorch_lightning.callbacks.finetuning import BackboneFinetuning from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.simple_models import ClassificationModel def test_lr_monitor_single_lr(tmpdir): diff --git a/test/tests/callbacks/test_model_summary.py b/test/unittests/callbacks/test_model_summary.py similarity index 97% rename from test/tests/callbacks/test_model_summary.py rename to test/unittests/callbacks/test_model_summary.py index 765911b8be9a1..9677e0e842f5e 100644 --- a/test/tests/callbacks/test_model_summary.py +++ b/test/unittests/callbacks/test_model_summary.py @@ -15,7 +15,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelSummary -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel def test_model_summary_callback_present_trainer(): diff --git a/test/tests/callbacks/test_prediction_writer.py b/test/unittests/callbacks/test_prediction_writer.py similarity index 98% rename from test/tests/callbacks/test_prediction_writer.py rename to test/unittests/callbacks/test_prediction_writer.py index f086316052995..0e7acd0205bab 100644 --- a/test/tests/callbacks/test_prediction_writer.py +++ b/test/unittests/callbacks/test_prediction_writer.py @@ -21,8 +21,8 @@ from pytorch_lightning.callbacks import BasePredictionWriter from pytorch_lightning.trainer.supporters import CombinedLoader from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf class DummyPredictionWriter(BasePredictionWriter): diff --git a/test/tests/callbacks/test_pruning.py b/test/unittests/callbacks/test_pruning.py similarity index 99% rename from test/tests/callbacks/test_pruning.py rename to test/unittests/callbacks/test_pruning.py index 19601979de29d..de27006cc28ca 100644 --- a/test/tests/callbacks/test_pruning.py +++ b/test/unittests/callbacks/test_pruning.py @@ -25,8 +25,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint, ModelPruning from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf class TestModel(BoringModel): diff --git a/test/tests/callbacks/test_quantization.py b/test/unittests/callbacks/test_quantization.py similarity index 97% rename from test/tests/callbacks/test_quantization.py rename to test/unittests/callbacks/test_quantization.py index efd1b6d2f4dcf..38f20f000d099 100644 --- a/test/tests/callbacks/test_quantization.py +++ b/test/unittests/callbacks/test_quantization.py @@ -24,10 +24,10 @@ from pytorch_lightning.callbacks import QuantizationAwareTraining from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.memory import get_model_size_mb -from tests.helpers.boring_model import RandomDataset -from tests.helpers.datamodules import RegressDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import RegressionModel +from unittests.helpers.boring_model import RandomDataset +from unittests.helpers.datamodules import RegressDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import RegressionModel @pytest.mark.parametrize("observe", ["average", "histogram"]) diff --git a/test/tests/callbacks/test_rich_model_summary.py b/test/unittests/callbacks/test_rich_model_summary.py similarity index 96% rename from test/tests/callbacks/test_rich_model_summary.py rename to test/unittests/callbacks/test_rich_model_summary.py index d9e4ec55902ca..33cf3dd59a543 100644 --- a/test/tests/callbacks/test_rich_model_summary.py +++ b/test/unittests/callbacks/test_rich_model_summary.py @@ -20,8 +20,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import RichModelSummary, RichProgressBar from pytorch_lightning.utilities.model_summary import summarize -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf @RunIf(rich=True) diff --git a/test/tests/callbacks/test_rich_progress_bar.py b/test/unittests/callbacks/test_rich_progress_bar.py similarity index 99% rename from test/tests/callbacks/test_rich_progress_bar.py rename to test/unittests/callbacks/test_rich_progress_bar.py index 8fdcb6c99e331..32c5f30d57b35 100644 --- a/test/tests/callbacks/test_rich_progress_bar.py +++ b/test/unittests/callbacks/test_rich_progress_bar.py @@ -21,8 +21,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ProgressBarBase, RichProgressBar from pytorch_lightning.callbacks.progress.rich_progress import RichProgressBarTheme -from tests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset +from unittests.helpers.runif import RunIf @RunIf(rich=True) diff --git a/test/tests/callbacks/test_stochastic_weight_avg.py b/test/unittests/callbacks/test_stochastic_weight_avg.py similarity index 98% rename from test/tests/callbacks/test_stochastic_weight_avg.py rename to test/unittests/callbacks/test_stochastic_weight_avg.py index dc1f59d52234c..7e150da668d97 100644 --- a/test/tests/callbacks/test_stochastic_weight_avg.py +++ b/test/unittests/callbacks/test_stochastic_weight_avg.py @@ -24,8 +24,8 @@ from pytorch_lightning.callbacks import StochasticWeightAveraging from pytorch_lightning.strategies import DDPSpawnStrategy, Strategy from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset +from unittests.helpers.runif import RunIf class SwaTestModel(BoringModel): diff --git a/test/tests/callbacks/test_timer.py b/test/unittests/callbacks/test_timer.py similarity index 98% rename from test/tests/callbacks/test_timer.py rename to test/unittests/callbacks/test_timer.py index 21792b430a35f..07a8901adc938 100644 --- a/test/tests/callbacks/test_timer.py +++ b/test/unittests/callbacks/test_timer.py @@ -22,8 +22,8 @@ from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.callbacks.timer import Timer from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf def test_trainer_flag(caplog): diff --git a/test/tests/callbacks/test_tqdm_progress_bar.py b/test/unittests/callbacks/test_tqdm_progress_bar.py similarity index 99% rename from test/tests/callbacks/test_tqdm_progress_bar.py rename to test/unittests/callbacks/test_tqdm_progress_bar.py index 14da4258a09a9..8b9326504e938 100644 --- a/test/tests/callbacks/test_tqdm_progress_bar.py +++ b/test/unittests/callbacks/test_tqdm_progress_bar.py @@ -29,8 +29,8 @@ from pytorch_lightning.callbacks.progress.tqdm_progress import Tqdm from pytorch_lightning.core.module import LightningModule from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf class MockTqdm(Tqdm): diff --git a/test/tests/checkpointing/__init__.py b/test/unittests/checkpointing/__init__.py similarity index 100% rename from test/tests/checkpointing/__init__.py rename to test/unittests/checkpointing/__init__.py diff --git a/test/tests/checkpointing/test_checkpoint_callback_frequency.py b/test/unittests/checkpointing/test_checkpoint_callback_frequency.py similarity index 98% rename from test/tests/checkpointing/test_checkpoint_callback_frequency.py rename to test/unittests/checkpointing/test_checkpoint_callback_frequency.py index 197349a39867e..80ce080b2dc02 100644 --- a/test/tests/checkpointing/test_checkpoint_callback_frequency.py +++ b/test/unittests/checkpointing/test_checkpoint_callback_frequency.py @@ -18,8 +18,8 @@ import torch from pytorch_lightning import callbacks, Trainer -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf def test_disabled_checkpointing(tmpdir): diff --git a/test/tests/checkpointing/test_legacy_checkpoints.py b/test/unittests/checkpointing/test_legacy_checkpoints.py similarity index 98% rename from test/tests/checkpointing/test_legacy_checkpoints.py rename to test/unittests/checkpointing/test_legacy_checkpoints.py index ac2806cbf3811..2d904fcfa2f1e 100644 --- a/test/tests/checkpointing/test_legacy_checkpoints.py +++ b/test/unittests/checkpointing/test_legacy_checkpoints.py @@ -22,7 +22,7 @@ import pytorch_lightning as pl from pytorch_lightning import Callback, Trainer -from tests import _PATH_LEGACY, _PROJECT_ROOT +from unittests import _PATH_LEGACY, _PROJECT_ROOT LEGACY_CHECKPOINTS_PATH = os.path.join(_PATH_LEGACY, "checkpoints") CHECKPOINT_EXTENSION = ".ckpt" diff --git a/test/tests/checkpointing/test_model_checkpoint.py b/test/unittests/checkpointing/test_model_checkpoint.py similarity index 99% rename from test/tests/checkpointing/test_model_checkpoint.py rename to test/unittests/checkpointing/test_model_checkpoint.py index fc2fa981c9f58..18523550e1971 100644 --- a/test/tests/checkpointing/test_model_checkpoint.py +++ b/test/unittests/checkpointing/test_model_checkpoint.py @@ -31,15 +31,15 @@ from torch import optim import pytorch_lightning as pl -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.loggers import TensorBoardLogger from pytorch_lightning.utilities.cloud_io import load as pl_load from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _OMEGACONF_AVAILABLE -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf if _OMEGACONF_AVAILABLE: from omegaconf import Container, OmegaConf diff --git a/test/tests/checkpointing/test_torch_saving.py b/test/unittests/checkpointing/test_torch_saving.py similarity index 96% rename from test/tests/checkpointing/test_torch_saving.py rename to test/unittests/checkpointing/test_torch_saving.py index f2f29e0865da4..0eb5ea07b701e 100644 --- a/test/tests/checkpointing/test_torch_saving.py +++ b/test/unittests/checkpointing/test_torch_saving.py @@ -16,8 +16,8 @@ import torch from pytorch_lightning import Trainer -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf def test_model_torch_save(tmpdir): diff --git a/test/tests/checkpointing/test_trainer_checkpoint.py b/test/unittests/checkpointing/test_trainer_checkpoint.py similarity index 99% rename from test/tests/checkpointing/test_trainer_checkpoint.py rename to test/unittests/checkpointing/test_trainer_checkpoint.py index 50b279b98c14b..6063f89f400e4 100644 --- a/test/tests/checkpointing/test_trainer_checkpoint.py +++ b/test/unittests/checkpointing/test_trainer_checkpoint.py @@ -23,7 +23,7 @@ from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.plugins.io.torch_plugin import TorchCheckpointIO from pytorch_lightning.plugins.io.xla_plugin import XLACheckpointIO -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_finetuning_with_ckpt_path(tmpdir): diff --git a/test/tests/conftest.py b/test/unittests/conftest.py similarity index 99% rename from test/tests/conftest.py rename to test/unittests/conftest.py index fac9c6de26297..84577ee263a44 100644 --- a/test/tests/conftest.py +++ b/test/unittests/conftest.py @@ -24,7 +24,7 @@ from pytorch_lightning.plugins.environments.lightning_environment import find_free_network_port from pytorch_lightning.trainer.connectors.signal_connector import SignalConnector from pytorch_lightning.utilities.imports import _IS_WINDOWS -from tests import _PATH_DATASETS +from unittests import _PATH_DATASETS @pytest.fixture(scope="session") diff --git a/test/tests/core/__init__.py b/test/unittests/core/__init__.py similarity index 100% rename from test/tests/core/__init__.py rename to test/unittests/core/__init__.py diff --git a/test/tests/core/test_datamodules.py b/test/unittests/core/test_datamodules.py similarity index 98% rename from test/tests/core/test_datamodules.py rename to test/unittests/core/test_datamodules.py index ffab893d7be57..823a96557f839 100644 --- a/test/tests/core/test_datamodules.py +++ b/test/unittests/core/test_datamodules.py @@ -27,11 +27,11 @@ from pytorch_lightning.trainer.states import TrainerFn from pytorch_lightning.utilities import _OMEGACONF_AVAILABLE, AttributeDict from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringDataModule, BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel -from tests.helpers.utils import reset_seed +from unittests.helpers import BoringDataModule, BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel +from unittests.helpers.utils import reset_seed if _OMEGACONF_AVAILABLE: from omegaconf import OmegaConf diff --git a/test/tests/core/test_lightning_module.py b/test/unittests/core/test_lightning_module.py similarity index 99% rename from test/tests/core/test_lightning_module.py rename to test/unittests/core/test_lightning_module.py index 9f51bca98e5d1..4253697abeb15 100644 --- a/test/tests/core/test_lightning_module.py +++ b/test/unittests/core/test_lightning_module.py @@ -23,8 +23,8 @@ from pytorch_lightning.loggers import TensorBoardLogger from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _TORCH_GREATER_EQUAL_1_11 -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf def test_lightning_module_not_abstract(): diff --git a/test/tests/core/test_lightning_optimizer.py b/test/unittests/core/test_lightning_optimizer.py similarity index 99% rename from test/tests/core/test_lightning_optimizer.py rename to test/unittests/core/test_lightning_optimizer.py index 0ee82fcc2e4ec..51db3103cf798 100644 --- a/test/tests/core/test_lightning_optimizer.py +++ b/test/unittests/core/test_lightning_optimizer.py @@ -20,7 +20,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.core.optimizer import LightningOptimizer from pytorch_lightning.loops.optimization.optimizer_loop import Closure -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel @pytest.mark.parametrize("auto", (True, False)) diff --git a/test/tests/core/test_metric_result_integration.py b/test/unittests/core/test_metric_result_integration.py similarity index 99% rename from test/tests/core/test_metric_result_integration.py rename to test/unittests/core/test_metric_result_integration.py index 45fc1291ed9ba..2edf0391337ba 100644 --- a/test/tests/core/test_metric_result_integration.py +++ b/test/unittests/core/test_metric_result_integration.py @@ -24,7 +24,7 @@ from torch.nn import ModuleDict, ModuleList from torchmetrics import Metric, MetricCollection -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.trainer.connectors.logger_connector.result import ( @@ -33,8 +33,8 @@ _ResultMetric, _Sync, ) -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf class DummyMetric(Metric): diff --git a/test/tests/core/test_results.py b/test/unittests/core/test_results.py similarity index 94% rename from test/tests/core/test_results.py rename to test/unittests/core/test_results.py index a39ce51788ff9..507f005d3eeba 100644 --- a/test/tests/core/test_results.py +++ b/test/unittests/core/test_results.py @@ -15,10 +15,10 @@ import torch.distributed as dist import torch.multiprocessing as mp -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning.trainer.connectors.logger_connector.result import _Sync from pytorch_lightning.utilities.distributed import sync_ddp_if_available -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf def _setup_ddp(rank, worldsize): diff --git a/test/tests/deprecated_api/__init__.py b/test/unittests/deprecated_api/__init__.py similarity index 95% rename from test/tests/deprecated_api/__init__.py rename to test/unittests/deprecated_api/__init__.py index 5480f398da341..d1a73c1fa24cc 100644 --- a/test/tests/deprecated_api/__init__.py +++ b/test/unittests/deprecated_api/__init__.py @@ -16,7 +16,7 @@ from contextlib import contextmanager from typing import Optional -from tests.helpers.utils import no_warning_call +from unittests.helpers.utils import no_warning_call def _soft_unimport_module(str_module): diff --git a/test/tests/deprecated_api/test_remove_1-7.py b/test/unittests/deprecated_api/test_remove_1-7.py similarity index 97% rename from test/tests/deprecated_api/test_remove_1-7.py rename to test/unittests/deprecated_api/test_remove_1-7.py index d681a554e7e9c..5d336d2b2ad51 100644 --- a/test/tests/deprecated_api/test_remove_1-7.py +++ b/test/unittests/deprecated_api/test_remove_1-7.py @@ -31,9 +31,9 @@ TorchElasticEnvironment, ) from pytorch_lightning.strategies import SingleDeviceStrategy -from tests.deprecated_api import _soft_unimport_module -from tests.helpers import BoringModel -from tests.plugins.environments.test_lsf_environment import _make_rankfile +from unittests.deprecated_api import _soft_unimport_module +from unittests.helpers import BoringModel +from unittests.plugins.environments.test_lsf_environment import _make_rankfile def test_v1_7_0_on_interrupt(tmpdir): diff --git a/test/tests/deprecated_api/test_remove_1-8.py b/test/unittests/deprecated_api/test_remove_1-8.py similarity index 99% rename from test/tests/deprecated_api/test_remove_1-8.py rename to test/unittests/deprecated_api/test_remove_1-8.py index f168cfcd12f34..8c6b51f538b6a 100644 --- a/test/tests/deprecated_api/test_remove_1-8.py +++ b/test/unittests/deprecated_api/test_remove_1-8.py @@ -47,10 +47,10 @@ from pytorch_lightning.utilities.enums import DeviceType, DistributedType from pytorch_lightning.utilities.imports import _TORCHTEXT_LEGACY from pytorch_lightning.utilities.rank_zero import rank_zero_only, rank_zero_warn -from tests.deprecated_api import no_deprecated_call -from tests.helpers.boring_model import BoringDataModule, BoringModel -from tests.helpers.runif import RunIf -from tests.helpers.torchtext_utils import get_dummy_torchtext_data_iterator +from unittests.deprecated_api import no_deprecated_call +from unittests.helpers.boring_model import BoringDataModule, BoringModel +from unittests.helpers.runif import RunIf +from unittests.helpers.torchtext_utils import get_dummy_torchtext_data_iterator def test_v1_8_0_deprecated_distributed_type_enum(): diff --git a/test/tests/deprecated_api/test_remove_1-9.py b/test/unittests/deprecated_api/test_remove_1-9.py similarity index 100% rename from test/tests/deprecated_api/test_remove_1-9.py rename to test/unittests/deprecated_api/test_remove_1-9.py diff --git a/test/tests/deprecated_api/test_remove_2-0.py b/test/unittests/deprecated_api/test_remove_2-0.py similarity index 97% rename from test/tests/deprecated_api/test_remove_2-0.py rename to test/unittests/deprecated_api/test_remove_2-0.py index 88eb8c985dbc7..f378d8a5c2d0c 100644 --- a/test/tests/deprecated_api/test_remove_2-0.py +++ b/test/unittests/deprecated_api/test_remove_2-0.py @@ -18,8 +18,8 @@ import pytorch_lightning from pytorch_lightning import Trainer -from tests.callbacks.test_callbacks import OldStatefulCallback -from tests.helpers import BoringModel +from unittests.callbacks.test_callbacks import OldStatefulCallback +from unittests.helpers import BoringModel def test_v2_0_0_deprecated_num_processes(): diff --git a/test/unittests/helpers/__init__.py b/test/unittests/helpers/__init__.py new file mode 100644 index 0000000000000..aec39b5bc6e24 --- /dev/null +++ b/test/unittests/helpers/__init__.py @@ -0,0 +1,7 @@ +from unittests.helpers.boring_model import ( # noqa: F401 + BoringDataModule, + BoringModel, + ManualOptimBoringModel, + RandomDataset, +) +from unittests.helpers.datasets import TrialMNIST # noqa: F401 diff --git a/test/tests/helpers/advanced_models.py b/test/unittests/helpers/advanced_models.py similarity index 98% rename from test/tests/helpers/advanced_models.py rename to test/unittests/helpers/advanced_models.py index ba69c22286408..a524c47d060be 100644 --- a/test/tests/helpers/advanced_models.py +++ b/test/unittests/helpers/advanced_models.py @@ -20,8 +20,8 @@ from pytorch_lightning.core.module import LightningModule from pytorch_lightning.utilities.imports import _TORCHVISION_AVAILABLE -from tests import _PATH_DATASETS -from tests.helpers.datasets import AverageDataset, MNIST, TrialMNIST +from unittests import _PATH_DATASETS +from unittests.helpers.datasets import AverageDataset, MNIST, TrialMNIST if _TORCHVISION_AVAILABLE: from torchvision import models, transforms diff --git a/test/tests/helpers/boring_model.py b/test/unittests/helpers/boring_model.py similarity index 100% rename from test/tests/helpers/boring_model.py rename to test/unittests/helpers/boring_model.py diff --git a/test/tests/helpers/dataloaders.py b/test/unittests/helpers/dataloaders.py similarity index 100% rename from test/tests/helpers/dataloaders.py rename to test/unittests/helpers/dataloaders.py diff --git a/test/tests/helpers/datamodules.py b/test/unittests/helpers/datamodules.py similarity index 98% rename from test/tests/helpers/datamodules.py rename to test/unittests/helpers/datamodules.py index 2d2d1190472c5..c9e1262ed16f4 100644 --- a/test/tests/helpers/datamodules.py +++ b/test/unittests/helpers/datamodules.py @@ -19,7 +19,7 @@ from pytorch_lightning.core.datamodule import LightningDataModule from pytorch_lightning.utilities import _module_available -from tests.helpers.datasets import MNIST, SklearnDataset, TrialMNIST +from unittests.helpers.datasets import MNIST, SklearnDataset, TrialMNIST _SKLEARN_AVAILABLE = _module_available("sklearn") if _SKLEARN_AVAILABLE: diff --git a/test/tests/helpers/datasets.py b/test/unittests/helpers/datasets.py similarity index 100% rename from test/tests/helpers/datasets.py rename to test/unittests/helpers/datasets.py diff --git a/test/tests/helpers/deterministic_model.py b/test/unittests/helpers/deterministic_model.py similarity index 100% rename from test/tests/helpers/deterministic_model.py rename to test/unittests/helpers/deterministic_model.py diff --git a/test/tests/helpers/imports.py b/test/unittests/helpers/imports.py similarity index 100% rename from test/tests/helpers/imports.py rename to test/unittests/helpers/imports.py diff --git a/test/tests/helpers/pipelines.py b/test/unittests/helpers/pipelines.py similarity index 96% rename from test/tests/helpers/pipelines.py rename to test/unittests/helpers/pipelines.py index 00a07ab496088..aae50a3e64a63 100644 --- a/test/tests/helpers/pipelines.py +++ b/test/unittests/helpers/pipelines.py @@ -15,8 +15,8 @@ from torchmetrics.functional import accuracy from pytorch_lightning import LightningDataModule, LightningModule, Trainer -from tests.helpers import BoringModel -from tests.helpers.utils import get_default_logger, load_model_from_checkpoint, reset_seed +from unittests.helpers import BoringModel +from unittests.helpers.utils import get_default_logger, load_model_from_checkpoint, reset_seed def run_model_test_without_loggers( diff --git a/test/tests/helpers/runif.py b/test/unittests/helpers/runif.py similarity index 100% rename from test/tests/helpers/runif.py rename to test/unittests/helpers/runif.py diff --git a/test/tests/helpers/simple_models.py b/test/unittests/helpers/simple_models.py similarity index 100% rename from test/tests/helpers/simple_models.py rename to test/unittests/helpers/simple_models.py diff --git a/test/tests/helpers/test_datasets.py b/test/unittests/helpers/test_datasets.py similarity index 91% rename from test/tests/helpers/test_datasets.py rename to test/unittests/helpers/test_datasets.py index 76669ae0e480d..aa79db8fc7ce0 100644 --- a/test/tests/helpers/test_datasets.py +++ b/test/unittests/helpers/test_datasets.py @@ -16,8 +16,8 @@ import cloudpickle import pytest -from tests import _PATH_DATASETS -from tests.helpers.datasets import AverageDataset, MNIST, TrialMNIST +from unittests import _PATH_DATASETS +from unittests.helpers.datasets import AverageDataset, MNIST, TrialMNIST @pytest.mark.parametrize( diff --git a/test/tests/helpers/test_models.py b/test/unittests/helpers/test_models.py similarity index 82% rename from test/tests/helpers/test_models.py rename to test/unittests/helpers/test_models.py index a6e5437115d5e..a1dca802c79d5 100644 --- a/test/tests/helpers/test_models.py +++ b/test/unittests/helpers/test_models.py @@ -16,10 +16,10 @@ import pytest from pytorch_lightning import Trainer -from tests.helpers.advanced_models import BasicGAN, ParityModuleMNIST, ParityModuleRNN -from tests.helpers.boring_model import BoringModel -from tests.helpers.datamodules import ClassifDataModule, RegressDataModule -from tests.helpers.simple_models import ClassificationModel, RegressionModel +from unittests.helpers.advanced_models import BasicGAN, ParityModuleMNIST, ParityModuleRNN +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.datamodules import ClassifDataModule, RegressDataModule +from unittests.helpers.simple_models import ClassificationModel, RegressionModel @pytest.mark.parametrize( diff --git a/test/tests/helpers/torchtext_utils.py b/test/unittests/helpers/torchtext_utils.py similarity index 95% rename from test/tests/helpers/torchtext_utils.py rename to test/unittests/helpers/torchtext_utils.py index c166ba8c8df7e..86693f316be79 100644 --- a/test/tests/helpers/torchtext_utils.py +++ b/test/unittests/helpers/torchtext_utils.py @@ -14,7 +14,7 @@ import random import string -from tests.helpers.imports import Dataset, Example, Field, Iterator +from unittests.helpers.imports import Dataset, Example, Field, Iterator def _generate_random_string(length: int = 10): diff --git a/test/tests/helpers/utils.py b/test/unittests/helpers/utils.py similarity index 97% rename from test/tests/helpers/utils.py rename to test/unittests/helpers/utils.py index 0e62c4b109ef5..645d84b3eb432 100644 --- a/test/tests/helpers/utils.py +++ b/test/unittests/helpers/utils.py @@ -23,8 +23,8 @@ from pytorch_lightning import seed_everything from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.loggers import TensorBoardLogger -from tests import _TEMP_PATH, RANDOM_PORTS -from tests.helpers.boring_model import BoringModel +from unittests import _TEMP_PATH, RANDOM_PORTS +from unittests.helpers.boring_model import BoringModel def get_default_logger(save_dir, version=None): diff --git a/test/tests/lite/__init__.py b/test/unittests/lite/__init__.py similarity index 100% rename from test/tests/lite/__init__.py rename to test/unittests/lite/__init__.py diff --git a/test/tests/lite/test_lite.py b/test/unittests/lite/test_lite.py similarity index 99% rename from test/tests/lite/test_lite.py rename to test/unittests/lite/test_lite.py index d59d87bdede40..65609ba615b32 100644 --- a/test/tests/lite/test_lite.py +++ b/test/unittests/lite/test_lite.py @@ -30,7 +30,7 @@ from pytorch_lightning.utilities import _StrategyType from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.seed import pl_worker_init_function -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf class EmptyLite(LightningLite): diff --git a/test/tests/lite/test_parity.py b/test/unittests/lite/test_parity.py similarity index 98% rename from test/tests/lite/test_parity.py rename to test/unittests/lite/test_parity.py index 537ed67c31bc0..597727f633c62 100644 --- a/test/tests/lite/test_parity.py +++ b/test/unittests/lite/test_parity.py @@ -32,8 +32,8 @@ from pytorch_lightning.strategies.ddp_spawn import DDPSpawnStrategy from pytorch_lightning.utilities.apply_func import apply_to_collection, move_data_to_device from pytorch_lightning.utilities.cloud_io import atomic_save -from tests.helpers.boring_model import RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import RandomDataset +from unittests.helpers.runif import RunIf class BoringModel(nn.Module): diff --git a/test/tests/lite/test_wrappers.py b/test/unittests/lite/test_wrappers.py similarity index 99% rename from test/tests/lite/test_wrappers.py rename to test/unittests/lite/test_wrappers.py index 23b179d30b237..b38431caebfd9 100644 --- a/test/tests/lite/test_wrappers.py +++ b/test/unittests/lite/test_wrappers.py @@ -20,7 +20,7 @@ from pytorch_lightning.core.mixins import DeviceDtypeModuleMixin from pytorch_lightning.lite import LightningLite from pytorch_lightning.lite.wrappers import _LiteDataLoader, _LiteModule, _LiteOptimizer -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf class EmptyLite(LightningLite): diff --git a/test/tests/loggers/__init__.py b/test/unittests/loggers/__init__.py similarity index 100% rename from test/tests/loggers/__init__.py rename to test/unittests/loggers/__init__.py diff --git a/test/tests/loggers/test_all.py b/test/unittests/loggers/test_all.py similarity index 97% rename from test/tests/loggers/test_all.py rename to test/unittests/loggers/test_all.py index d72bb8cc51ae4..30d078a578c37 100644 --- a/test/tests/loggers/test_all.py +++ b/test/unittests/loggers/test_all.py @@ -21,7 +21,7 @@ import pytest import torch -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Callback, Trainer from pytorch_lightning.loggers import ( CometLogger, @@ -32,11 +32,11 @@ WandbLogger, ) from pytorch_lightning.loggers.logger import DummyExperiment -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf -from tests.loggers.test_comet import _patch_comet_atexit -from tests.loggers.test_mlflow import mock_mlflow_run_creation -from tests.loggers.test_neptune import create_neptune_mock +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf +from unittests.loggers.test_comet import _patch_comet_atexit +from unittests.loggers.test_mlflow import mock_mlflow_run_creation +from unittests.loggers.test_neptune import create_neptune_mock LOGGER_CTX_MANAGERS = ( mock.patch("pytorch_lightning.loggers.comet.comet_ml"), diff --git a/test/tests/loggers/test_comet.py b/test/unittests/loggers/test_comet.py similarity index 99% rename from test/tests/loggers/test_comet.py rename to test/unittests/loggers/test_comet.py index e09b954a61a6a..40a3558a48b1a 100644 --- a/test/tests/loggers/test_comet.py +++ b/test/unittests/loggers/test_comet.py @@ -20,7 +20,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.loggers import CometLogger from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def _patch_comet_atexit(monkeypatch): diff --git a/test/tests/loggers/test_csv.py b/test/unittests/loggers/test_csv.py similarity index 97% rename from test/tests/loggers/test_csv.py rename to test/unittests/loggers/test_csv.py index bd859ad1f5ebb..a1e1d0dd39de4 100644 --- a/test/tests/loggers/test_csv.py +++ b/test/unittests/loggers/test_csv.py @@ -21,8 +21,8 @@ from pytorch_lightning.core.saving import load_hparams_from_yaml from pytorch_lightning.loggers import CSVLogger from pytorch_lightning.loggers.csv_logs import ExperimentWriter -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.simple_models import ClassificationModel def test_file_logger_automatic_versioning(tmpdir): diff --git a/test/tests/loggers/test_logger.py b/test/unittests/loggers/test_logger.py similarity index 99% rename from test/tests/loggers/test_logger.py rename to test/unittests/loggers/test_logger.py index 250ec7861c5b6..698ec9ef15eb9 100644 --- a/test/tests/loggers/test_logger.py +++ b/test/unittests/loggers/test_logger.py @@ -27,7 +27,7 @@ from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.logger import _convert_params, _sanitize_params from pytorch_lightning.utilities.rank_zero import rank_zero_only -from tests.helpers.boring_model import BoringDataModule, BoringModel +from unittests.helpers.boring_model import BoringDataModule, BoringModel def test_logger_collection(): diff --git a/test/tests/loggers/test_mlflow.py b/test/unittests/loggers/test_mlflow.py similarity index 99% rename from test/tests/loggers/test_mlflow.py rename to test/unittests/loggers/test_mlflow.py index 1e9e8ec271bd5..8df8ece24f0f4 100644 --- a/test/tests/loggers/test_mlflow.py +++ b/test/unittests/loggers/test_mlflow.py @@ -20,7 +20,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.loggers import _MLFLOW_AVAILABLE, MLFlowLogger from pytorch_lightning.loggers.mlflow import MLFLOW_RUN_NAME, resolve_tags -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def mock_mlflow_run_creation(logger, experiment_name=None, experiment_id=None, run_id=None): diff --git a/test/tests/loggers/test_neptune.py b/test/unittests/loggers/test_neptune.py similarity index 99% rename from test/tests/loggers/test_neptune.py rename to test/unittests/loggers/test_neptune.py index 87e52159b61d6..528ca53f909e7 100644 --- a/test/tests/loggers/test_neptune.py +++ b/test/unittests/loggers/test_neptune.py @@ -22,7 +22,7 @@ from pytorch_lightning import __version__, Trainer from pytorch_lightning.loggers import NeptuneLogger -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def fetchable_paths(value): diff --git a/test/tests/loggers/test_tensorboard.py b/test/unittests/loggers/test_tensorboard.py similarity index 99% rename from test/tests/loggers/test_tensorboard.py rename to test/unittests/loggers/test_tensorboard.py index 1c3af727a745f..cb058d0ca85c3 100644 --- a/test/tests/loggers/test_tensorboard.py +++ b/test/unittests/loggers/test_tensorboard.py @@ -25,8 +25,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.loggers import TensorBoardLogger from pytorch_lightning.utilities.imports import _compare_version, _OMEGACONF_AVAILABLE -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf if _OMEGACONF_AVAILABLE: from omegaconf import OmegaConf diff --git a/test/tests/loggers/test_wandb.py b/test/unittests/loggers/test_wandb.py similarity index 99% rename from test/tests/loggers/test_wandb.py rename to test/unittests/loggers/test_wandb.py index adb91aab6da32..d0416e45b86c7 100644 --- a/test/tests/loggers/test_wandb.py +++ b/test/unittests/loggers/test_wandb.py @@ -20,8 +20,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.loggers import WandbLogger from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel -from tests.helpers.utils import no_warning_call +from unittests.helpers import BoringModel +from unittests.helpers.utils import no_warning_call @mock.patch("pytorch_lightning.loggers.wandb.wandb") diff --git a/test/tests/loops/__init__.py b/test/unittests/loops/__init__.py similarity index 100% rename from test/tests/loops/__init__.py rename to test/unittests/loops/__init__.py diff --git a/test/tests/loops/batch/__init__.py b/test/unittests/loops/batch/__init__.py similarity index 100% rename from test/tests/loops/batch/__init__.py rename to test/unittests/loops/batch/__init__.py diff --git a/test/tests/loops/batch/test_truncated_bptt.py b/test/unittests/loops/batch/test_truncated_bptt.py similarity index 100% rename from test/tests/loops/batch/test_truncated_bptt.py rename to test/unittests/loops/batch/test_truncated_bptt.py diff --git a/test/tests/loops/epoch/__init__.py b/test/unittests/loops/epoch/__init__.py similarity index 100% rename from test/tests/loops/epoch/__init__.py rename to test/unittests/loops/epoch/__init__.py diff --git a/test/tests/loops/epoch/test_training_epoch_loop.py b/test/unittests/loops/epoch/test_training_epoch_loop.py similarity index 99% rename from test/tests/loops/epoch/test_training_epoch_loop.py rename to test/unittests/loops/epoch/test_training_epoch_loop.py index d6f6a906cc053..25096971b95ce 100644 --- a/test/tests/loops/epoch/test_training_epoch_loop.py +++ b/test/unittests/loops/epoch/test_training_epoch_loop.py @@ -19,8 +19,8 @@ from pytorch_lightning import LightningModule from pytorch_lightning.loops import TrainingEpochLoop from pytorch_lightning.trainer.trainer import Trainer -from tests.deprecated_api import no_deprecated_call -from tests.helpers.boring_model import BoringModel +from unittests.deprecated_api import no_deprecated_call +from unittests.helpers.boring_model import BoringModel _out00 = {"loss": 0.0} _out01 = {"loss": 0.1} diff --git a/test/tests/loops/optimization/__init__.py b/test/unittests/loops/optimization/__init__.py similarity index 100% rename from test/tests/loops/optimization/__init__.py rename to test/unittests/loops/optimization/__init__.py diff --git a/test/tests/loops/optimization/test_closure.py b/test/unittests/loops/optimization/test_closure.py similarity index 97% rename from test/tests/loops/optimization/test_closure.py rename to test/unittests/loops/optimization/test_closure.py index 996d9d83b9948..306ae143a894e 100644 --- a/test/tests/loops/optimization/test_closure.py +++ b/test/unittests/loops/optimization/test_closure.py @@ -16,7 +16,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_optimizer_step_no_closure_raises(tmpdir): diff --git a/test/tests/loops/optimization/test_manual_loop.py b/test/unittests/loops/optimization/test_manual_loop.py similarity index 97% rename from test/tests/loops/optimization/test_manual_loop.py rename to test/unittests/loops/optimization/test_manual_loop.py index 04b517eb99334..ec7006c82d4da 100644 --- a/test/tests/loops/optimization/test_manual_loop.py +++ b/test/unittests/loops/optimization/test_manual_loop.py @@ -17,7 +17,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.loops.optimization.manual_loop import ManualResult from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_manual_result(): diff --git a/test/tests/loops/optimization/test_optimizer_loop.py b/test/unittests/loops/optimization/test_optimizer_loop.py similarity index 99% rename from test/tests/loops/optimization/test_optimizer_loop.py rename to test/unittests/loops/optimization/test_optimizer_loop.py index d04cc7343c9eb..f59db8d4159fa 100644 --- a/test/tests/loops/optimization/test_optimizer_loop.py +++ b/test/unittests/loops/optimization/test_optimizer_loop.py @@ -23,7 +23,7 @@ from pytorch_lightning.core.optimizer import LightningOptimizer from pytorch_lightning.loops.optimization.optimizer_loop import ClosureResult from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_closure_result_deepcopy(): diff --git a/test/tests/loops/test_all.py b/test/unittests/loops/test_all.py similarity index 97% rename from test/tests/loops/test_all.py rename to test/unittests/loops/test_all.py index e1a5db3082ed1..877ea288e82ce 100644 --- a/test/tests/loops/test_all.py +++ b/test/unittests/loops/test_all.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. from pytorch_lightning import Callback, Trainer -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf class BatchHookObserverCallback(Callback): diff --git a/test/tests/loops/test_evaluation_loop.py b/test/unittests/loops/test_evaluation_loop.py similarity index 98% rename from test/tests/loops/test_evaluation_loop.py rename to test/unittests/loops/test_evaluation_loop.py index 01a75fa8d2456..1dffb9f456baa 100644 --- a/test/tests/loops/test_evaluation_loop.py +++ b/test/unittests/loops/test_evaluation_loop.py @@ -21,8 +21,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.loops import EvaluationEpochLoop from pytorch_lightning.utilities.model_helpers import is_overridden -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf @mock.patch("pytorch_lightning.loops.dataloader.evaluation_loop.EvaluationLoop._on_evaluation_epoch_end") diff --git a/test/tests/loops/test_evaluation_loop_flow.py b/test/unittests/loops/test_evaluation_loop_flow.py similarity index 99% rename from test/tests/loops/test_evaluation_loop_flow.py rename to test/unittests/loops/test_evaluation_loop_flow.py index 07a24ee3e20b0..cf35e4e3fda90 100644 --- a/test/tests/loops/test_evaluation_loop_flow.py +++ b/test/unittests/loops/test_evaluation_loop_flow.py @@ -18,7 +18,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.core.module import LightningModule from pytorch_lightning.trainer.states import RunningStage -from tests.helpers.deterministic_model import DeterministicModel +from unittests.helpers.deterministic_model import DeterministicModel def test__eval_step__flow(tmpdir): diff --git a/test/tests/loops/test_flow_warnings.py b/test/unittests/loops/test_flow_warnings.py similarity index 95% rename from test/tests/loops/test_flow_warnings.py rename to test/unittests/loops/test_flow_warnings.py index 02cdf309f6801..67a8207d867bf 100644 --- a/test/tests/loops/test_flow_warnings.py +++ b/test/unittests/loops/test_flow_warnings.py @@ -14,7 +14,7 @@ import warnings from pytorch_lightning import Trainer -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel class TestModel(BoringModel): diff --git a/test/tests/loops/test_loop_state_dict.py b/test/unittests/loops/test_loop_state_dict.py similarity index 100% rename from test/tests/loops/test_loop_state_dict.py rename to test/unittests/loops/test_loop_state_dict.py diff --git a/test/tests/loops/test_loops.py b/test/unittests/loops/test_loops.py similarity index 99% rename from test/tests/loops/test_loops.py rename to test/unittests/loops/test_loops.py index 792cac22a394e..1f97ed29b6d38 100644 --- a/test/tests/loops/test_loops.py +++ b/test/unittests/loops/test_loops.py @@ -27,8 +27,8 @@ from pytorch_lightning.loops import EvaluationLoop, Loop, TrainingBatchLoop, TrainingEpochLoop from pytorch_lightning.trainer.progress import BaseProgress from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf class NestedLoop(Loop): diff --git a/test/tests/loops/test_training_loop.py b/test/unittests/loops/test_training_loop.py similarity index 99% rename from test/tests/loops/test_training_loop.py rename to test/unittests/loops/test_training_loop.py index 3de02d5f8bb1c..6c612e5472aa4 100644 --- a/test/tests/loops/test_training_loop.py +++ b/test/unittests/loops/test_training_loop.py @@ -15,7 +15,7 @@ import torch from pytorch_lightning import seed_everything, Trainer -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_outputs_format(tmpdir): diff --git a/test/tests/loops/test_training_loop_flow_dict.py b/test/unittests/loops/test_training_loop_flow_dict.py similarity index 98% rename from test/tests/loops/test_training_loop_flow_dict.py rename to test/unittests/loops/test_training_loop_flow_dict.py index e04ca4c55c6fc..b5311946c3d11 100644 --- a/test/tests/loops/test_training_loop_flow_dict.py +++ b/test/unittests/loops/test_training_loop_flow_dict.py @@ -17,7 +17,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.core.module import LightningModule -from tests.helpers.deterministic_model import DeterministicModel +from unittests.helpers.deterministic_model import DeterministicModel def test__training_step__flow_dict(tmpdir): diff --git a/test/tests/loops/test_training_loop_flow_scalar.py b/test/unittests/loops/test_training_loop_flow_scalar.py similarity index 98% rename from test/tests/loops/test_training_loop_flow_scalar.py rename to test/unittests/loops/test_training_loop_flow_scalar.py index 20f5d917d97c9..bdfcfa7756be1 100644 --- a/test/tests/loops/test_training_loop_flow_scalar.py +++ b/test/unittests/loops/test_training_loop_flow_scalar.py @@ -20,9 +20,9 @@ from pytorch_lightning.core.module import LightningModule from pytorch_lightning.loops.optimization.optimizer_loop import Closure from pytorch_lightning.trainer.states import RunningStage -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.deterministic_model import DeterministicModel -from tests.helpers.utils import no_warning_call +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.deterministic_model import DeterministicModel +from unittests.helpers.utils import no_warning_call def test__training_step__flow_scalar(tmpdir): diff --git a/test/tests/loops/test_utilities.py b/test/unittests/loops/test_utilities.py similarity index 100% rename from test/tests/loops/test_utilities.py rename to test/unittests/loops/test_utilities.py diff --git a/test/tests/models/__init__.py b/test/unittests/models/__init__.py similarity index 100% rename from test/tests/models/__init__.py rename to test/unittests/models/__init__.py diff --git a/test/tests/models/conf/config.yaml b/test/unittests/models/conf/config.yaml similarity index 100% rename from test/tests/models/conf/config.yaml rename to test/unittests/models/conf/config.yaml diff --git a/test/tests/models/conf/training/default.yaml b/test/unittests/models/conf/training/default.yaml similarity index 100% rename from test/tests/models/conf/training/default.yaml rename to test/unittests/models/conf/training/default.yaml diff --git a/test/tests/models/data/__init__.py b/test/unittests/models/data/__init__.py similarity index 100% rename from test/tests/models/data/__init__.py rename to test/unittests/models/data/__init__.py diff --git a/test/tests/models/data/horovod/__init__.py b/test/unittests/models/data/horovod/__init__.py similarity index 100% rename from test/tests/models/data/horovod/__init__.py rename to test/unittests/models/data/horovod/__init__.py diff --git a/test/tests/models/data/horovod/test_train_script.py b/test/unittests/models/data/horovod/test_train_script.py similarity index 92% rename from test/tests/models/data/horovod/test_train_script.py rename to test/unittests/models/data/horovod/test_train_script.py index 1d32b9ce9d29a..50da1c2c6c3ed 100644 --- a/test/tests/models/data/horovod/test_train_script.py +++ b/test/unittests/models/data/horovod/test_train_script.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from tests.models.data.horovod.train_default_model import run_test_from_config +from unittests.models.data.horovod.train_default_model import run_test_from_config def test_horovod_model_script(tmpdir): diff --git a/test/tests/models/data/horovod/train_default_model.py b/test/unittests/models/data/horovod/train_default_model.py similarity index 96% rename from test/tests/models/data/horovod/train_default_model.py rename to test/unittests/models/data/horovod/train_default_model.py index ab692d379a7f2..65e016372104c 100644 --- a/test/tests/models/data/horovod/train_default_model.py +++ b/test/unittests/models/data/horovod/train_default_model.py @@ -36,8 +36,8 @@ else: print("You requested to import Horovod which is missing or not supported for your OS.") -from tests.helpers import BoringModel # noqa: E402 -from tests.helpers.utils import reset_seed, set_random_main_port # noqa: E402 +from unittests.helpers import BoringModel # noqa: E402 +from unittests.helpers.utils import reset_seed, set_random_main_port # noqa: E402 parser = argparse.ArgumentParser() parser.add_argument("--trainer-options", required=True) diff --git a/test/tests/models/test_amp.py b/test/unittests/models/test_amp.py similarity index 98% rename from test/tests/models/test_amp.py rename to test/unittests/models/test_amp.py index e391321de18fb..708deb730fb89 100644 --- a/test/tests/models/test_amp.py +++ b/test/unittests/models/test_amp.py @@ -19,11 +19,11 @@ from torch import optim from torch.utils.data import DataLoader -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.plugins.environments import SLURMEnvironment -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf class AMPTestModel(BoringModel): diff --git a/test/tests/models/test_cpu.py b/test/unittests/models/test_cpu.py similarity index 96% rename from test/tests/models/test_cpu.py rename to test/unittests/models/test_cpu.py index 48359522b7030..49670e4dc2d86 100644 --- a/test/tests/models/test_cpu.py +++ b/test/unittests/models/test_cpu.py @@ -15,14 +15,14 @@ import torch -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.callbacks import Callback, EarlyStopping, ModelCheckpoint -from tests.helpers import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel def test_cpu_slurm_save_load(tmpdir): diff --git a/test/tests/models/test_gpu.py b/test/unittests/models/test_gpu.py similarity index 96% rename from test/tests/models/test_gpu.py rename to test/unittests/models/test_gpu.py index fd3cc14945144..b408d3c26e7de 100644 --- a/test/tests/models/test_gpu.py +++ b/test/unittests/models/test_gpu.py @@ -20,19 +20,19 @@ import pytest import torch -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.accelerators import CPUAccelerator, GPUAccelerator from pytorch_lightning.plugins.environments import TorchElasticEnvironment from pytorch_lightning.utilities import device_parser from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _compare_version, _TORCHTEXT_LEGACY -from tests.helpers import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.imports import Batch, Dataset, Example, Field, LabelField -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.imports import Batch, Dataset, Example, Field, LabelField +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel PL_VERSION_LT_1_5 = _compare_version("pytorch_lightning", operator.lt, "1.5") PRETEND_N_OF_GPUS = 16 diff --git a/test/tests/models/test_grad_norm.py b/test/unittests/models/test_grad_norm.py similarity index 97% rename from test/tests/models/test_grad_norm.py rename to test/unittests/models/test_grad_norm.py index ae8494b6c672e..f01937ca2fadd 100644 --- a/test/tests/models/test_grad_norm.py +++ b/test/unittests/models/test_grad_norm.py @@ -17,8 +17,8 @@ import pytest from pytorch_lightning import Trainer -from tests.helpers import BoringModel -from tests.helpers.utils import reset_seed +from unittests.helpers import BoringModel +from unittests.helpers.utils import reset_seed class ModelWithManualGradTracker(BoringModel): diff --git a/test/tests/models/test_hooks.py b/test/unittests/models/test_hooks.py similarity index 99% rename from test/tests/models/test_hooks.py rename to test/unittests/models/test_hooks.py index 5f33fd8a6654a..66be46ab87124 100644 --- a/test/tests/models/test_hooks.py +++ b/test/unittests/models/test_hooks.py @@ -21,8 +21,8 @@ from torch.utils.data import DataLoader from pytorch_lightning import __version__, Callback, LightningDataModule, LightningModule, Trainer -from tests.helpers import BoringDataModule, BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers import BoringDataModule, BoringModel, RandomDataset +from unittests.helpers.runif import RunIf @pytest.mark.parametrize("max_steps", [1, 2, 3]) diff --git a/test/tests/models/test_horovod.py b/test/unittests/models/test_horovod.py similarity index 98% rename from test/tests/models/test_horovod.py rename to test/unittests/models/test_horovod.py index 14a652ce0c8e2..6da2f0d54ff30 100644 --- a/test/tests/models/test_horovod.py +++ b/test/unittests/models/test_horovod.py @@ -25,15 +25,15 @@ from torch import optim from torchmetrics.classification.accuracy import Accuracy -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.accelerators import CPUAccelerator from pytorch_lightning.utilities import _HOROVOD_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel -from tests.helpers.advanced_models import BasicGAN -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.advanced_models import BasicGAN +from unittests.helpers.runif import RunIf if _HOROVOD_AVAILABLE: import horovod @@ -42,7 +42,7 @@ @RunIf(min_cuda_gpus=1, horovod=True) def test_nccl_is_available_on_gpu_environment(): - from tests.helpers.runif import _HOROVOD_NCCL_AVAILABLE + from unittests.helpers.runif import _HOROVOD_NCCL_AVAILABLE # the GPU environment should always install Horovod NCCL assert _HOROVOD_NCCL_AVAILABLE diff --git a/test/tests/models/test_hparams.py b/test/unittests/models/test_hparams.py similarity index 99% rename from test/tests/models/test_hparams.py rename to test/unittests/models/test_hparams.py index b09a816d11d72..51e0cefd96281 100644 --- a/test/tests/models/test_hparams.py +++ b/test/unittests/models/test_hparams.py @@ -32,10 +32,10 @@ from pytorch_lightning.core.saving import load_hparams_from_yaml, save_hparams_to_yaml from pytorch_lightning.utilities import _HYDRA_EXPERIMENTAL_AVAILABLE, _OMEGACONF_AVAILABLE, AttributeDict, is_picklable from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.boring_model import BoringDataModule -from tests.helpers.runif import RunIf -from tests.helpers.utils import no_warning_call +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.boring_model import BoringDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import no_warning_call if _HYDRA_EXPERIMENTAL_AVAILABLE: from hydra.experimental import compose, initialize diff --git a/test/tests/models/test_onnx.py b/test/unittests/models/test_onnx.py similarity index 95% rename from test/tests/models/test_onnx.py rename to test/unittests/models/test_onnx.py index 7b305b768074b..1dea692bd474c 100644 --- a/test/tests/models/test_onnx.py +++ b/test/unittests/models/test_onnx.py @@ -18,12 +18,12 @@ import pytest import torch -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf -from tests.utilities.test_model_summary import UnorderedModel +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf +from unittests.utilities.test_model_summary import UnorderedModel def test_model_saves_with_input_sample(tmpdir): diff --git a/test/tests/models/test_restore.py b/test/unittests/models/test_restore.py similarity index 98% rename from test/tests/models/test_restore.py rename to test/unittests/models/test_restore.py index 149d96385987b..f2c00a01443b4 100644 --- a/test/tests/models/test_restore.py +++ b/test/unittests/models/test_restore.py @@ -24,16 +24,16 @@ import torch import torch.nn.functional as F -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning import Callback, Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.trainer.states import TrainerFn -from tests.helpers import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel -from tests.loops.test_loops import CustomException +from unittests.helpers import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel +from unittests.loops.test_loops import CustomException class ModelTrainerPropertyParity(Callback): diff --git a/test/tests/models/test_torchscript.py b/test/unittests/models/test_torchscript.py similarity index 97% rename from test/tests/models/test_torchscript.py rename to test/unittests/models/test_torchscript.py index 6b82eca43aab9..d7d0b26247767 100644 --- a/test/tests/models/test_torchscript.py +++ b/test/unittests/models/test_torchscript.py @@ -20,9 +20,9 @@ from fsspec.implementations.local import LocalFileSystem from pytorch_lightning.utilities.cloud_io import get_filesystem -from tests.helpers import BoringModel -from tests.helpers.advanced_models import BasicGAN, ParityModuleRNN -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.advanced_models import BasicGAN, ParityModuleRNN +from unittests.helpers.runif import RunIf @pytest.mark.parametrize("modelclass", [BoringModel, ParityModuleRNN, BasicGAN]) diff --git a/test/tests/models/test_tpu.py b/test/unittests/models/test_tpu.py similarity index 98% rename from test/tests/models/test_tpu.py rename to test/unittests/models/test_tpu.py index 82f10875a1dec..2ee217447c01e 100644 --- a/test/tests/models/test_tpu.py +++ b/test/unittests/models/test_tpu.py @@ -19,8 +19,8 @@ import torch from torch.utils.data import DataLoader -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.accelerators import TPUAccelerator from pytorch_lightning.callbacks import EarlyStopping @@ -29,9 +29,9 @@ from pytorch_lightning.utilities import _TPU_AVAILABLE from pytorch_lightning.utilities.distributed import ReduceOp from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.runif import RunIf -from tests.helpers.utils import pl_multi_process_test +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import pl_multi_process_test if _TPU_AVAILABLE: import torch_xla diff --git a/test/tests/overrides/__init__.py b/test/unittests/overrides/__init__.py similarity index 100% rename from test/tests/overrides/__init__.py rename to test/unittests/overrides/__init__.py diff --git a/test/tests/overrides/test_base.py b/test/unittests/overrides/test_base.py similarity index 97% rename from test/tests/overrides/test_base.py rename to test/unittests/overrides/test_base.py index 4b76fd028af66..b1847e20c5da2 100644 --- a/test/tests/overrides/test_base.py +++ b/test/unittests/overrides/test_base.py @@ -20,7 +20,7 @@ _LightningPrecisionModuleWrapperBase, unwrap_lightning_module, ) -from tests.helpers import BoringModel +from unittests.helpers import BoringModel @pytest.mark.parametrize("wrapper_class", [_LightningModuleWrapperBase, _LightningPrecisionModuleWrapperBase]) diff --git a/test/tests/overrides/test_data_parallel.py b/test/unittests/overrides/test_data_parallel.py similarity index 98% rename from test/tests/overrides/test_data_parallel.py rename to test/unittests/overrides/test_data_parallel.py index 0bc6646c7ccd2..d415e11b22aa9 100644 --- a/test/tests/overrides/test_data_parallel.py +++ b/test/unittests/overrides/test_data_parallel.py @@ -26,8 +26,8 @@ unsqueeze_scalar_tensor, ) from pytorch_lightning.trainer.states import RunningStage -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf @pytest.mark.parametrize("wrapper_class", [LightningParallelModule, LightningDistributedModule]) diff --git a/test/tests/overrides/test_distributed.py b/test/unittests/overrides/test_distributed.py similarity index 100% rename from test/tests/overrides/test_distributed.py rename to test/unittests/overrides/test_distributed.py diff --git a/test/tests/plugins/__init__.py b/test/unittests/plugins/__init__.py similarity index 100% rename from test/tests/plugins/__init__.py rename to test/unittests/plugins/__init__.py diff --git a/test/tests/plugins/environments/__init__.py b/test/unittests/plugins/environments/__init__.py similarity index 100% rename from test/tests/plugins/environments/__init__.py rename to test/unittests/plugins/environments/__init__.py diff --git a/test/tests/plugins/environments/test_kubeflow_environment.py b/test/unittests/plugins/environments/test_kubeflow_environment.py similarity index 100% rename from test/tests/plugins/environments/test_kubeflow_environment.py rename to test/unittests/plugins/environments/test_kubeflow_environment.py diff --git a/test/tests/plugins/environments/test_lightning_environment.py b/test/unittests/plugins/environments/test_lightning_environment.py similarity index 100% rename from test/tests/plugins/environments/test_lightning_environment.py rename to test/unittests/plugins/environments/test_lightning_environment.py diff --git a/test/tests/plugins/environments/test_lsf_environment.py b/test/unittests/plugins/environments/test_lsf_environment.py similarity index 100% rename from test/tests/plugins/environments/test_lsf_environment.py rename to test/unittests/plugins/environments/test_lsf_environment.py diff --git a/test/tests/plugins/environments/test_slurm_environment.py b/test/unittests/plugins/environments/test_slurm_environment.py similarity index 100% rename from test/tests/plugins/environments/test_slurm_environment.py rename to test/unittests/plugins/environments/test_slurm_environment.py diff --git a/test/tests/plugins/environments/test_torchelastic_environment.py b/test/unittests/plugins/environments/test_torchelastic_environment.py similarity index 98% rename from test/tests/plugins/environments/test_torchelastic_environment.py rename to test/unittests/plugins/environments/test_torchelastic_environment.py index 9b9d83a4d84e5..c590486ba11f1 100644 --- a/test/tests/plugins/environments/test_torchelastic_environment.py +++ b/test/unittests/plugins/environments/test_torchelastic_environment.py @@ -18,7 +18,7 @@ import pytest from pytorch_lightning.plugins.environments import TorchElasticEnvironment -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf @mock.patch.dict(os.environ, {}, clear=True) diff --git a/test/tests/plugins/environments/torch_elastic_deadlock.py b/test/unittests/plugins/environments/torch_elastic_deadlock.py similarity index 95% rename from test/tests/plugins/environments/torch_elastic_deadlock.py rename to test/unittests/plugins/environments/torch_elastic_deadlock.py index 287f1b00bb2a0..4913f33bafd38 100644 --- a/test/tests/plugins/environments/torch_elastic_deadlock.py +++ b/test/unittests/plugins/environments/torch_elastic_deadlock.py @@ -5,7 +5,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.strategies.ddp import DDPStrategy from pytorch_lightning.utilities.exceptions import DeadlockDetectedException -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel if os.getenv("PL_RUN_STANDALONE_TESTS", "0") == "1" and os.getenv("PL_RECONCILE_PROCESS", "0") == "1": diff --git a/test/tests/plugins/precision/__init__.py b/test/unittests/plugins/precision/__init__.py similarity index 100% rename from test/tests/plugins/precision/__init__.py rename to test/unittests/plugins/precision/__init__.py diff --git a/test/tests/plugins/precision/hpu/ops_bf16.txt b/test/unittests/plugins/precision/hpu/ops_bf16.txt similarity index 100% rename from test/tests/plugins/precision/hpu/ops_bf16.txt rename to test/unittests/plugins/precision/hpu/ops_bf16.txt diff --git a/test/tests/plugins/precision/hpu/ops_fp32.txt b/test/unittests/plugins/precision/hpu/ops_fp32.txt similarity index 100% rename from test/tests/plugins/precision/hpu/ops_fp32.txt rename to test/unittests/plugins/precision/hpu/ops_fp32.txt diff --git a/test/tests/plugins/precision/hpu/test_hpu.py b/test/unittests/plugins/precision/hpu/test_hpu.py similarity index 97% rename from test/tests/plugins/precision/hpu/test_hpu.py rename to test/unittests/plugins/precision/hpu/test_hpu.py index 5701bf2dc2caa..7be34493e59da 100644 --- a/test/tests/plugins/precision/hpu/test_hpu.py +++ b/test/unittests/plugins/precision/hpu/test_hpu.py @@ -19,8 +19,8 @@ from pytorch_lightning import Callback, LightningModule, Trainer from pytorch_lightning.plugins import HPUPrecisionPlugin from pytorch_lightning.strategies.single_hpu import SingleHPUStrategy -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf @pytest.fixture diff --git a/test/tests/plugins/precision/test_deepspeed_precision.py b/test/unittests/plugins/precision/test_deepspeed_precision.py similarity index 100% rename from test/tests/plugins/precision/test_deepspeed_precision.py rename to test/unittests/plugins/precision/test_deepspeed_precision.py diff --git a/test/tests/plugins/precision/test_sharded_precision.py b/test/unittests/plugins/precision/test_sharded_precision.py similarity index 97% rename from test/tests/plugins/precision/test_sharded_precision.py rename to test/unittests/plugins/precision/test_sharded_precision.py index 754095912fb53..3734d1ca3c1e9 100644 --- a/test/tests/plugins/precision/test_sharded_precision.py +++ b/test/unittests/plugins/precision/test_sharded_precision.py @@ -17,7 +17,7 @@ from pytorch_lightning.plugins import ShardedNativeMixedPrecisionPlugin from pytorch_lightning.utilities import _FAIRSCALE_AVAILABLE -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf ShardedGradScaler = None if _FAIRSCALE_AVAILABLE: diff --git a/test/tests/plugins/precision/test_tpu_bf16_plugin.py b/test/unittests/plugins/precision/test_tpu_bf16_plugin.py similarity index 100% rename from test/tests/plugins/precision/test_tpu_bf16_plugin.py rename to test/unittests/plugins/precision/test_tpu_bf16_plugin.py diff --git a/test/tests/plugins/test_amp_plugins.py b/test/unittests/plugins/test_amp_plugins.py similarity index 99% rename from test/tests/plugins/test_amp_plugins.py rename to test/unittests/plugins/test_amp_plugins.py index c71041fc335b9..36cffc5931e1d 100644 --- a/test/tests/plugins/test_amp_plugins.py +++ b/test/unittests/plugins/test_amp_plugins.py @@ -21,8 +21,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.plugins import ApexMixedPrecisionPlugin, NativeMixedPrecisionPlugin from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf class MyNativeAMP(NativeMixedPrecisionPlugin): diff --git a/test/tests/plugins/test_checkpoint_io_plugin.py b/test/unittests/plugins/test_checkpoint_io_plugin.py similarity index 98% rename from test/tests/plugins/test_checkpoint_io_plugin.py rename to test/unittests/plugins/test_checkpoint_io_plugin.py index 4ac26261e5682..1918428433c2d 100644 --- a/test/tests/plugins/test_checkpoint_io_plugin.py +++ b/test/unittests/plugins/test_checkpoint_io_plugin.py @@ -22,7 +22,7 @@ from pytorch_lightning.plugins import CheckpointIO from pytorch_lightning.strategies import SingleDeviceStrategy from pytorch_lightning.utilities.types import _PATH -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel class CustomCheckpointIO(CheckpointIO): diff --git a/test/tests/plugins/test_cluster_integration.py b/test/unittests/plugins/test_cluster_integration.py similarity index 99% rename from test/tests/plugins/test_cluster_integration.py rename to test/unittests/plugins/test_cluster_integration.py index ad99087fd8b5b..d34643779bdb5 100644 --- a/test/tests/plugins/test_cluster_integration.py +++ b/test/unittests/plugins/test_cluster_integration.py @@ -21,7 +21,7 @@ from pytorch_lightning.plugins.environments import LightningEnvironment, SLURMEnvironment, TorchElasticEnvironment from pytorch_lightning.strategies import DDP2Strategy, DDPShardedStrategy, DDPStrategy, DeepSpeedStrategy from pytorch_lightning.utilities.rank_zero import rank_zero_only -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf def environment_combinations(): diff --git a/test/tests/plugins/test_double_plugin.py b/test/unittests/plugins/test_double_plugin.py similarity index 98% rename from test/tests/plugins/test_double_plugin.py rename to test/unittests/plugins/test_double_plugin.py index afa57bf666818..0d7731b6afa88 100644 --- a/test/tests/plugins/test_double_plugin.py +++ b/test/unittests/plugins/test_double_plugin.py @@ -20,8 +20,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.plugins import DoublePrecisionPlugin -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf class RandomFloatIntDataset(Dataset): diff --git a/test/tests/profiler/__init__.py b/test/unittests/profiler/__init__.py similarity index 100% rename from test/tests/profiler/__init__.py rename to test/unittests/profiler/__init__.py diff --git a/test/tests/profiler/test_profiler.py b/test/unittests/profiler/test_profiler.py similarity index 99% rename from test/tests/profiler/test_profiler.py rename to test/unittests/profiler/test_profiler.py index ab1cf7c8ab7f9..35081dc248f34 100644 --- a/test/tests/profiler/test_profiler.py +++ b/test/unittests/profiler/test_profiler.py @@ -29,8 +29,8 @@ from pytorch_lightning.profiler.pytorch import RegisterRecordFunction, warning_cache from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _KINETO_AVAILABLE -from tests.helpers import BoringModel, ManualOptimBoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel, ManualOptimBoringModel +from unittests.helpers.runif import RunIf PROFILER_OVERHEAD_MAX_TOLERANCE = 0.0005 diff --git a/test/tests/profiler/test_xla_profiler.py b/test/unittests/profiler/test_xla_profiler.py similarity index 95% rename from test/tests/profiler/test_xla_profiler.py rename to test/unittests/profiler/test_xla_profiler.py index d2234c56b7fe7..cac7ac711f70e 100644 --- a/test/tests/profiler/test_xla_profiler.py +++ b/test/unittests/profiler/test_xla_profiler.py @@ -19,8 +19,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.profiler import XLAProfiler from pytorch_lightning.utilities import _TPU_AVAILABLE -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf if _TPU_AVAILABLE: import torch_xla.debug.profiler as xp diff --git a/test/tests/strategies/__init__.py b/test/unittests/strategies/__init__.py similarity index 100% rename from test/tests/strategies/__init__.py rename to test/unittests/strategies/__init__.py diff --git a/test/tests/strategies/ddp_model.py b/test/unittests/strategies/ddp_model.py similarity index 93% rename from test/tests/strategies/ddp_model.py rename to test/unittests/strategies/ddp_model.py index c35e1475de309..28bd23a51d152 100644 --- a/test/tests/strategies/ddp_model.py +++ b/test/unittests/strategies/ddp_model.py @@ -18,8 +18,8 @@ import torch from pytorch_lightning import seed_everything, Trainer -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.simple_models import ClassificationModel def main(): diff --git a/test/tests/strategies/test_bagua_strategy.py b/test/unittests/strategies/test_bagua_strategy.py similarity index 97% rename from test/tests/strategies/test_bagua_strategy.py rename to test/unittests/strategies/test_bagua_strategy.py index 40b2a964a5ad0..6fcbd81768f85 100644 --- a/test/tests/strategies/test_bagua_strategy.py +++ b/test/unittests/strategies/test_bagua_strategy.py @@ -20,8 +20,8 @@ from pytorch_lightning.strategies import BaguaStrategy from pytorch_lightning.trainer.states import TrainerFn from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf class BoringModel4QAdam(BoringModel): diff --git a/test/tests/strategies/test_collaborative.py b/test/unittests/strategies/test_collaborative.py similarity index 99% rename from test/tests/strategies/test_collaborative.py rename to test/unittests/strategies/test_collaborative.py index 89711fed27efc..3622d597bbb06 100644 --- a/test/tests/strategies/test_collaborative.py +++ b/test/unittests/strategies/test_collaborative.py @@ -17,8 +17,8 @@ from pytorch_lightning.utilities import _HIVEMIND_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.types import STEP_OUTPUT -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf if _HIVEMIND_AVAILABLE: import hivemind diff --git a/test/tests/strategies/test_common.py b/test/unittests/strategies/test_common.py similarity index 91% rename from test/tests/strategies/test_common.py rename to test/unittests/strategies/test_common.py index d9ef50da57a33..3296e1c0436be 100644 --- a/test/tests/strategies/test_common.py +++ b/test/unittests/strategies/test_common.py @@ -14,14 +14,14 @@ import pytest import torch -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.strategies import DDPStrategy from pytorch_lightning.utilities.seed import seed_everything -from tests.helpers.boring_model import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.strategies.test_dp import CustomClassificationModelDP +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.strategies.test_dp import CustomClassificationModelDP @pytest.mark.parametrize( diff --git a/test/tests/strategies/test_custom_plugin.py b/test/unittests/strategies/test_custom_plugin.py similarity index 97% rename from test/tests/strategies/test_custom_plugin.py rename to test/unittests/strategies/test_custom_plugin.py index 7a8550627084e..b91423ff01218 100644 --- a/test/tests/strategies/test_custom_plugin.py +++ b/test/unittests/strategies/test_custom_plugin.py @@ -19,7 +19,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.strategies import SingleDeviceStrategy -from tests.helpers import BoringModel +from unittests.helpers import BoringModel @pytest.mark.parametrize("restore_optimizer_and_schedulers", [True, False]) diff --git a/test/tests/strategies/test_ddp.py b/test/unittests/strategies/test_ddp.py similarity index 97% rename from test/tests/strategies/test_ddp.py rename to test/unittests/strategies/test_ddp.py index 7eb383d3812da..94fc43c386138 100644 --- a/test/tests/strategies/test_ddp.py +++ b/test/unittests/strategies/test_ddp.py @@ -24,10 +24,10 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import Callback from pytorch_lightning.strategies import DDPStrategy -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf -from tests.strategies import ddp_model -from tests.utilities.distributed import call_training_script +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf +from unittests.strategies import ddp_model +from unittests.utilities.distributed import call_training_script CLI_ARGS = "--max_epochs 1 --accelerator gpu --devices 2 --strategy ddp" diff --git a/test/tests/strategies/test_ddp_fully_sharded_native.py b/test/unittests/strategies/test_ddp_fully_sharded_native.py similarity index 98% rename from test/tests/strategies/test_ddp_fully_sharded_native.py rename to test/unittests/strategies/test_ddp_fully_sharded_native.py index ab8e04b5f360b..5775351b143ed 100644 --- a/test/tests/strategies/test_ddp_fully_sharded_native.py +++ b/test/unittests/strategies/test_ddp_fully_sharded_native.py @@ -10,8 +10,8 @@ from pytorch_lightning.strategies import DDPFullyShardedNativeStrategy from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _TORCH_GREATER_EQUAL_1_12 -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf if _TORCH_GREATER_EQUAL_1_12: from torch.distributed.fsdp.fully_sharded_data_parallel import FullyShardedDataParallel diff --git a/test/tests/strategies/test_ddp_fully_sharded_with_full_state_dict.py b/test/unittests/strategies/test_ddp_fully_sharded_with_full_state_dict.py similarity index 98% rename from test/tests/strategies/test_ddp_fully_sharded_with_full_state_dict.py rename to test/unittests/strategies/test_ddp_fully_sharded_with_full_state_dict.py index 239ecf1c0923a..2d4ca824326be 100644 --- a/test/tests/strategies/test_ddp_fully_sharded_with_full_state_dict.py +++ b/test/unittests/strategies/test_ddp_fully_sharded_with_full_state_dict.py @@ -11,8 +11,8 @@ from pytorch_lightning.strategies import DDPFullyShardedStrategy from pytorch_lightning.utilities import _FAIRSCALE_FULLY_SHARDED_AVAILABLE from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf if _FAIRSCALE_FULLY_SHARDED_AVAILABLE: from fairscale.nn import FullyShardedDataParallel, wrap diff --git a/test/tests/strategies/test_ddp_spawn.py b/test/unittests/strategies/test_ddp_spawn.py similarity index 88% rename from test/tests/strategies/test_ddp_spawn.py rename to test/unittests/strategies/test_ddp_spawn.py index 3220095e1d064..8c1740de54e51 100644 --- a/test/tests/strategies/test_ddp_spawn.py +++ b/test/unittests/strategies/test_ddp_spawn.py @@ -11,14 +11,14 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning.callbacks import EarlyStopping from pytorch_lightning.trainer import Trainer -from tests.helpers import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel @RunIf(min_cuda_gpus=2) diff --git a/test/tests/strategies/test_ddp_spawn_strategy.py b/test/unittests/strategies/test_ddp_spawn_strategy.py similarity index 98% rename from test/tests/strategies/test_ddp_spawn_strategy.py rename to test/unittests/strategies/test_ddp_spawn_strategy.py index 5964a7cc39423..bb94acb92b01f 100644 --- a/test/tests/strategies/test_ddp_spawn_strategy.py +++ b/test/unittests/strategies/test_ddp_spawn_strategy.py @@ -22,8 +22,8 @@ from pytorch_lightning.strategies import DDPSpawnStrategy from pytorch_lightning.strategies.launchers.spawn import _SpawnLauncher from pytorch_lightning.trainer.states import TrainerFn -from tests.helpers.boring_model import BoringDataModule, BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringDataModule, BoringModel +from unittests.helpers.runif import RunIf class BoringModelDDPCPU(BoringModel): diff --git a/test/tests/strategies/test_ddp_strategy.py b/test/unittests/strategies/test_ddp_strategy.py similarity index 98% rename from test/tests/strategies/test_ddp_strategy.py rename to test/unittests/strategies/test_ddp_strategy.py index 5ee17e8a8d831..b4b9e7f34e361 100644 --- a/test/tests/strategies/test_ddp_strategy.py +++ b/test/unittests/strategies/test_ddp_strategy.py @@ -22,8 +22,8 @@ from pytorch_lightning.plugins.environments import ClusterEnvironment, LightningEnvironment from pytorch_lightning.strategies import DDPStrategy from pytorch_lightning.trainer.states import TrainerFn -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf class BoringModelGPU(BoringModel): diff --git a/test/tests/strategies/test_ddp_strategy_with_comm_hook.py b/test/unittests/strategies/test_ddp_strategy_with_comm_hook.py similarity index 99% rename from test/tests/strategies/test_ddp_strategy_with_comm_hook.py rename to test/unittests/strategies/test_ddp_strategy_with_comm_hook.py index f707741208aa7..0ae4ae6c6b2ef 100644 --- a/test/tests/strategies/test_ddp_strategy_with_comm_hook.py +++ b/test/unittests/strategies/test_ddp_strategy_with_comm_hook.py @@ -19,8 +19,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.strategies import DDPSpawnStrategy, DDPStrategy from pytorch_lightning.utilities import _TORCH_GREATER_EQUAL_1_10 -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf if torch.distributed.is_available(): from torch.distributed.algorithms.ddp_comm_hooks import default_hooks as default diff --git a/test/tests/strategies/test_deepspeed_strategy.py b/test/unittests/strategies/test_deepspeed_strategy.py similarity index 99% rename from test/tests/strategies/test_deepspeed_strategy.py rename to test/unittests/strategies/test_deepspeed_strategy.py index 86fb5396c25a5..bda5bb427d018 100644 --- a/test/tests/strategies/test_deepspeed_strategy.py +++ b/test/unittests/strategies/test_deepspeed_strategy.py @@ -38,9 +38,9 @@ _DEEPSPEED_GREATER_EQUAL_0_6, ) from pytorch_lightning.utilities.meta import init_meta_context -from tests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf if _DEEPSPEED_AVAILABLE: import deepspeed diff --git a/test/tests/strategies/test_dp.py b/test/unittests/strategies/test_dp.py similarity index 95% rename from test/tests/strategies/test_dp.py rename to test/unittests/strategies/test_dp.py index 07bf7097247a1..d8342e27c3456 100644 --- a/test/tests/strategies/test_dp.py +++ b/test/unittests/strategies/test_dp.py @@ -19,15 +19,15 @@ from torch.utils.data import DataLoader import pytorch_lightning as pl -import tests.helpers.pipelines as tpipes -import tests.helpers.utils as tutils +import unittests.helpers.pipelines as tpipes +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.callbacks import EarlyStopping from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel class CustomClassificationModelDP(ClassificationModel): diff --git a/test/tests/strategies/test_sharded_strategy.py b/test/unittests/strategies/test_sharded_strategy.py similarity index 99% rename from test/tests/strategies/test_sharded_strategy.py rename to test/unittests/strategies/test_sharded_strategy.py index b433de7a08ff1..3673b467ba775 100644 --- a/test/tests/strategies/test_sharded_strategy.py +++ b/test/unittests/strategies/test_sharded_strategy.py @@ -9,8 +9,8 @@ from pytorch_lightning.strategies import DDPShardedStrategy, DDPSpawnShardedStrategy from pytorch_lightning.trainer.states import TrainerFn from pytorch_lightning.utilities import _FAIRSCALE_AVAILABLE -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf if _FAIRSCALE_AVAILABLE: from fairscale.nn.data_parallel.sharded_ddp import ShardedDataParallel diff --git a/test/tests/strategies/test_single_device_strategy.py b/test/unittests/strategies/test_single_device_strategy.py similarity index 96% rename from test/tests/strategies/test_single_device_strategy.py rename to test/unittests/strategies/test_single_device_strategy.py index babc710f0e65b..408bb22347048 100644 --- a/test/tests/strategies/test_single_device_strategy.py +++ b/test/unittests/strategies/test_single_device_strategy.py @@ -18,8 +18,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.core.optimizer import LightningOptimizer from pytorch_lightning.strategies import SingleDeviceStrategy -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf def test_single_cpu(): diff --git a/test/tests/strategies/test_strategy_registry.py b/test/unittests/strategies/test_strategy_registry.py similarity index 99% rename from test/tests/strategies/test_strategy_registry.py rename to test/unittests/strategies/test_strategy_registry.py index 89422b3719a29..3cbfaa2c9bbed 100644 --- a/test/tests/strategies/test_strategy_registry.py +++ b/test/unittests/strategies/test_strategy_registry.py @@ -25,7 +25,7 @@ StrategyRegistry, TPUSpawnStrategy, ) -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf def test_strategy_registry_with_new_strategy(): diff --git a/test/tests/strategies/test_tpu_spawn.py b/test/unittests/strategies/test_tpu_spawn.py similarity index 93% rename from test/tests/strategies/test_tpu_spawn.py rename to test/unittests/strategies/test_tpu_spawn.py index 407c8d646502d..b63bf4bfccb6a 100644 --- a/test/tests/strategies/test_tpu_spawn.py +++ b/test/unittests/strategies/test_tpu_spawn.py @@ -22,10 +22,10 @@ from pytorch_lightning import Trainer from pytorch_lightning.strategies import TPUSpawnStrategy from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.dataloaders import CustomNotImplementedErrorDataloader -from tests.helpers.runif import RunIf -from tests.helpers.utils import pl_multi_process_test +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.dataloaders import CustomNotImplementedErrorDataloader +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import pl_multi_process_test class BoringModelNoDataloaders(BoringModel): diff --git a/test/tests/trainer/__init__.py b/test/unittests/trainer/__init__.py similarity index 100% rename from test/tests/trainer/__init__.py rename to test/unittests/trainer/__init__.py diff --git a/test/tests/trainer/connectors/__init__.py b/test/unittests/trainer/connectors/__init__.py similarity index 100% rename from test/tests/trainer/connectors/__init__.py rename to test/unittests/trainer/connectors/__init__.py diff --git a/test/tests/trainer/connectors/test_callback_connector.py b/test/unittests/trainer/connectors/test_callback_connector.py similarity index 99% rename from test/tests/trainer/connectors/test_callback_connector.py rename to test/unittests/trainer/connectors/test_callback_connector.py index d5d6bb9191108..03d4f6ec54bac 100644 --- a/test/tests/trainer/connectors/test_callback_connector.py +++ b/test/unittests/trainer/connectors/test_callback_connector.py @@ -30,7 +30,7 @@ ) from pytorch_lightning.trainer.connectors.callback_connector import CallbackConnector from pytorch_lightning.utilities.imports import _PYTHON_GREATER_EQUAL_3_8_0 -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_checkpoint_callbacks_are_last(tmpdir): diff --git a/test/tests/trainer/connectors/test_checkpoint_connector.py b/test/unittests/trainer/connectors/test_checkpoint_connector.py similarity index 99% rename from test/tests/trainer/connectors/test_checkpoint_connector.py rename to test/unittests/trainer/connectors/test_checkpoint_connector.py index 0ba21dea404fa..7906ec956dcd4 100644 --- a/test/tests/trainer/connectors/test_checkpoint_connector.py +++ b/test/unittests/trainer/connectors/test_checkpoint_connector.py @@ -22,7 +22,7 @@ from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.plugins.environments import SLURMEnvironment from pytorch_lightning.trainer.states import TrainerFn -from tests.helpers import BoringModel +from unittests.helpers import BoringModel # TODO: remove HPCHookedModel in v1.8 diff --git a/test/tests/trainer/connectors/test_data_connector.py b/test/unittests/trainer/connectors/test_data_connector.py similarity index 99% rename from test/tests/trainer/connectors/test_data_connector.py rename to test/unittests/trainer/connectors/test_data_connector.py index 7d1b6f0a23bb4..090e43914a12c 100644 --- a/test/tests/trainer/connectors/test_data_connector.py +++ b/test/unittests/trainer/connectors/test_data_connector.py @@ -27,9 +27,9 @@ from pytorch_lightning.utilities.data import _update_dataloader from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.warnings import PossibleUserWarning -from tests.helpers.boring_model import BoringDataModule, BoringModel, RandomDataset -from tests.helpers.runif import RunIf -from tests.helpers.utils import no_warning_call +from unittests.helpers.boring_model import BoringDataModule, BoringModel, RandomDataset +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import no_warning_call @RunIf(skip_windows=True) diff --git a/test/tests/trainer/connectors/test_signal_connector.py b/test/unittests/trainer/connectors/test_signal_connector.py similarity index 98% rename from test/tests/trainer/connectors/test_signal_connector.py rename to test/unittests/trainer/connectors/test_signal_connector.py index 5988809af420d..d1b3e4d474cae 100644 --- a/test/tests/trainer/connectors/test_signal_connector.py +++ b/test/unittests/trainer/connectors/test_signal_connector.py @@ -23,8 +23,8 @@ from pytorch_lightning.plugins.environments import SLURMEnvironment from pytorch_lightning.trainer.connectors.signal_connector import SignalConnector from pytorch_lightning.utilities.exceptions import ExitGracefullyException -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf @RunIf(skip_windows=True) diff --git a/test/tests/trainer/dynamic_args/__init__.py b/test/unittests/trainer/dynamic_args/__init__.py similarity index 100% rename from test/tests/trainer/dynamic_args/__init__.py rename to test/unittests/trainer/dynamic_args/__init__.py diff --git a/test/tests/trainer/dynamic_args/test_multiple_eval_dataloaders.py b/test/unittests/trainer/dynamic_args/test_multiple_eval_dataloaders.py similarity index 98% rename from test/tests/trainer/dynamic_args/test_multiple_eval_dataloaders.py rename to test/unittests/trainer/dynamic_args/test_multiple_eval_dataloaders.py index b4378f34c1211..0e48968710ae0 100644 --- a/test/tests/trainer/dynamic_args/test_multiple_eval_dataloaders.py +++ b/test/unittests/trainer/dynamic_args/test_multiple_eval_dataloaders.py @@ -15,7 +15,7 @@ from torch.utils.data import Dataset from pytorch_lightning import Trainer -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel class RandomDatasetA(Dataset): diff --git a/test/tests/trainer/flags/__init__.py b/test/unittests/trainer/flags/__init__.py similarity index 100% rename from test/tests/trainer/flags/__init__.py rename to test/unittests/trainer/flags/__init__.py diff --git a/test/tests/trainer/flags/test_check_val_every_n_epoch.py b/test/unittests/trainer/flags/test_check_val_every_n_epoch.py similarity index 97% rename from test/tests/trainer/flags/test_check_val_every_n_epoch.py rename to test/unittests/trainer/flags/test_check_val_every_n_epoch.py index ca2537b829cd7..8ff7c9c74ac40 100644 --- a/test/tests/trainer/flags/test_check_val_every_n_epoch.py +++ b/test/unittests/trainer/flags/test_check_val_every_n_epoch.py @@ -15,7 +15,7 @@ from torch.utils.data import DataLoader from pytorch_lightning.trainer.trainer import Trainer -from tests.helpers import BoringModel, RandomDataset +from unittests.helpers import BoringModel, RandomDataset @pytest.mark.parametrize( diff --git a/test/tests/trainer/flags/test_env_vars.py b/test/unittests/trainer/flags/test_env_vars.py similarity index 100% rename from test/tests/trainer/flags/test_env_vars.py rename to test/unittests/trainer/flags/test_env_vars.py diff --git a/test/tests/trainer/flags/test_fast_dev_run.py b/test/unittests/trainer/flags/test_fast_dev_run.py similarity index 99% rename from test/tests/trainer/flags/test_fast_dev_run.py rename to test/unittests/trainer/flags/test_fast_dev_run.py index 413fa6b09ae21..16a1db328148e 100644 --- a/test/tests/trainer/flags/test_fast_dev_run.py +++ b/test/unittests/trainer/flags/test_fast_dev_run.py @@ -7,7 +7,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.loggers.logger import DummyLogger -from tests.helpers import BoringModel +from unittests.helpers import BoringModel @pytest.mark.parametrize("tuner_alg", ["batch size scaler", "learning rate finder"]) diff --git a/test/tests/trainer/flags/test_limit_batches.py b/test/unittests/trainer/flags/test_limit_batches.py similarity index 98% rename from test/tests/trainer/flags/test_limit_batches.py rename to test/unittests/trainer/flags/test_limit_batches.py index f46eb3acb10ff..da50a1d896ca2 100644 --- a/test/tests/trainer/flags/test_limit_batches.py +++ b/test/unittests/trainer/flags/test_limit_batches.py @@ -17,7 +17,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.trainer.states import RunningStage -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel def test_num_dataloader_batches(tmpdir): diff --git a/test/tests/trainer/flags/test_min_max_epochs.py b/test/unittests/trainer/flags/test_min_max_epochs.py similarity index 96% rename from test/tests/trainer/flags/test_min_max_epochs.py rename to test/unittests/trainer/flags/test_min_max_epochs.py index e410e806ea2db..f31e6a9c7a6eb 100644 --- a/test/tests/trainer/flags/test_min_max_epochs.py +++ b/test/unittests/trainer/flags/test_min_max_epochs.py @@ -2,7 +2,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.utilities.warnings import PossibleUserWarning -from tests.helpers import BoringModel +from unittests.helpers import BoringModel @pytest.mark.parametrize( diff --git a/test/tests/trainer/flags/test_overfit_batches.py b/test/unittests/trainer/flags/test_overfit_batches.py similarity index 98% rename from test/tests/trainer/flags/test_overfit_batches.py rename to test/unittests/trainer/flags/test_overfit_batches.py index b6e5ad0a292c6..3433717bd4566 100644 --- a/test/tests/trainer/flags/test_overfit_batches.py +++ b/test/unittests/trainer/flags/test_overfit_batches.py @@ -18,8 +18,8 @@ from legacy.simple_classif_training import ClassifDataModule, ClassificationModel from pytorch_lightning import Trainer from pytorch_lightning.trainer.states import RunningStage -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf @pytest.mark.parametrize("overfit_batches", [1, 2, 0.1, 0.25, 1.0]) diff --git a/test/tests/trainer/flags/test_val_check_interval.py b/test/unittests/trainer/flags/test_val_check_interval.py similarity index 97% rename from test/tests/trainer/flags/test_val_check_interval.py rename to test/unittests/trainer/flags/test_val_check_interval.py index b575faa81203c..33fadf1cc4878 100644 --- a/test/tests/trainer/flags/test_val_check_interval.py +++ b/test/unittests/trainer/flags/test_val_check_interval.py @@ -18,8 +18,8 @@ from pytorch_lightning.trainer.trainer import Trainer from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.boring_model import RandomIterableDataset +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.boring_model import RandomIterableDataset @pytest.mark.parametrize("max_epochs", [1, 2, 3]) diff --git a/test/tests/trainer/logging_/__init__.py b/test/unittests/trainer/logging_/__init__.py similarity index 100% rename from test/tests/trainer/logging_/__init__.py rename to test/unittests/trainer/logging_/__init__.py diff --git a/test/tests/trainer/logging_/test_distributed_logging.py b/test/unittests/trainer/logging_/test_distributed_logging.py similarity index 98% rename from test/tests/trainer/logging_/test_distributed_logging.py rename to test/unittests/trainer/logging_/test_distributed_logging.py index 25e8958fe54e6..d8ad154dedbc1 100644 --- a/test/tests/trainer/logging_/test_distributed_logging.py +++ b/test/unittests/trainer/logging_/test_distributed_logging.py @@ -18,8 +18,8 @@ import pytorch_lightning as pl from pytorch_lightning import Callback, Trainer from pytorch_lightning.loggers.logger import Logger -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf class AllRankLogger(Logger): diff --git a/test/tests/trainer/logging_/test_eval_loop_logging.py b/test/unittests/trainer/logging_/test_eval_loop_logging.py similarity index 99% rename from test/tests/trainer/logging_/test_eval_loop_logging.py rename to test/unittests/trainer/logging_/test_eval_loop_logging.py index 9f94b38b5c0f1..9142272dcfe7a 100644 --- a/test/tests/trainer/logging_/test_eval_loop_logging.py +++ b/test/unittests/trainer/logging_/test_eval_loop_logging.py @@ -30,8 +30,8 @@ from pytorch_lightning.trainer.states import RunningStage from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _PYTHON_GREATER_EQUAL_3_8_0, _RICH_AVAILABLE -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf if _RICH_AVAILABLE: from rich import get_console diff --git a/test/tests/trainer/logging_/test_logger_connector.py b/test/unittests/trainer/logging_/test_logger_connector.py similarity index 99% rename from test/tests/trainer/logging_/test_logger_connector.py rename to test/unittests/trainer/logging_/test_logger_connector.py index c535e23ac7c26..1e5b1eff5f097 100644 --- a/test/tests/trainer/logging_/test_logger_connector.py +++ b/test/unittests/trainer/logging_/test_logger_connector.py @@ -25,9 +25,9 @@ from pytorch_lightning.trainer.connectors.logger_connector.fx_validator import _FxValidator from pytorch_lightning.trainer.connectors.logger_connector.result import _ResultCollection from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf -from tests.models.test_hooks import get_members +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf +from unittests.models.test_hooks import get_members def test_fx_validator(): diff --git a/test/tests/trainer/logging_/test_loop_logging.py b/test/unittests/trainer/logging_/test_loop_logging.py similarity index 98% rename from test/tests/trainer/logging_/test_loop_logging.py rename to test/unittests/trainer/logging_/test_loop_logging.py index fca7a8546c3e5..895cf9cdcba44 100644 --- a/test/tests/trainer/logging_/test_loop_logging.py +++ b/test/unittests/trainer/logging_/test_loop_logging.py @@ -22,7 +22,7 @@ from pytorch_lightning.trainer.connectors.logger_connector.fx_validator import _FxValidator from pytorch_lightning.trainer.connectors.logger_connector.result import _ResultCollection from pytorch_lightning.trainer.states import RunningStage, TrainerFn -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel def test_default_level_for_hooks_that_support_logging(): diff --git a/test/tests/trainer/logging_/test_progress_bar_logging.py b/test/unittests/trainer/logging_/test_progress_bar_logging.py similarity index 94% rename from test/tests/trainer/logging_/test_progress_bar_logging.py rename to test/unittests/trainer/logging_/test_progress_bar_logging.py index d19251c02d37c..c545bd9d22898 100644 --- a/test/tests/trainer/logging_/test_progress_bar_logging.py +++ b/test/unittests/trainer/logging_/test_progress_bar_logging.py @@ -1,7 +1,7 @@ import pytest from pytorch_lightning import Trainer -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_logging_to_progress_bar_with_reserved_key(tmpdir): diff --git a/test/tests/trainer/logging_/test_train_loop_logging.py b/test/unittests/trainer/logging_/test_train_loop_logging.py similarity index 99% rename from test/tests/trainer/logging_/test_train_loop_logging.py rename to test/unittests/trainer/logging_/test_train_loop_logging.py index 23c81dfa78c09..f56900b149578 100644 --- a/test/tests/trainer/logging_/test_train_loop_logging.py +++ b/test/unittests/trainer/logging_/test_train_loop_logging.py @@ -29,8 +29,8 @@ from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint, TQDMProgressBar from pytorch_lightning.core.module import LightningModule from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset, RandomDictDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset, RandomDictDataset +from unittests.helpers.runif import RunIf def test__training_step__log(tmpdir): diff --git a/test/tests/trainer/optimization/__init__.py b/test/unittests/trainer/optimization/__init__.py similarity index 100% rename from test/tests/trainer/optimization/__init__.py rename to test/unittests/trainer/optimization/__init__.py diff --git a/test/tests/trainer/optimization/test_backward_calls.py b/test/unittests/trainer/optimization/test_backward_calls.py similarity index 97% rename from test/tests/trainer/optimization/test_backward_calls.py rename to test/unittests/trainer/optimization/test_backward_calls.py index fbe01375b2db9..55b25384f3791 100644 --- a/test/tests/trainer/optimization/test_backward_calls.py +++ b/test/unittests/trainer/optimization/test_backward_calls.py @@ -4,7 +4,7 @@ import torch from pytorch_lightning import Trainer -from tests.helpers import BoringModel +from unittests.helpers import BoringModel @pytest.mark.parametrize("num_steps", [1, 2, 3]) diff --git a/test/tests/trainer/optimization/test_manual_optimization.py b/test/unittests/trainer/optimization/test_manual_optimization.py similarity index 99% rename from test/tests/trainer/optimization/test_manual_optimization.py rename to test/unittests/trainer/optimization/test_manual_optimization.py index b0fe01ccadf4a..683c0fe59560d 100644 --- a/test/tests/trainer/optimization/test_manual_optimization.py +++ b/test/unittests/trainer/optimization/test_manual_optimization.py @@ -23,8 +23,8 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.strategies import Strategy -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf class ManualOptModel(BoringModel): diff --git a/test/tests/trainer/optimization/test_multiple_optimizers.py b/test/unittests/trainer/optimization/test_multiple_optimizers.py similarity index 99% rename from test/tests/trainer/optimization/test_multiple_optimizers.py rename to test/unittests/trainer/optimization/test_multiple_optimizers.py index 41d380b4aa8a7..362a6bb76f2f2 100644 --- a/test/tests/trainer/optimization/test_multiple_optimizers.py +++ b/test/unittests/trainer/optimization/test_multiple_optimizers.py @@ -16,7 +16,7 @@ import torch import pytorch_lightning as pl -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel class MultiOptModel(BoringModel): diff --git a/test/tests/trainer/optimization/test_optimizers.py b/test/unittests/trainer/optimization/test_optimizers.py similarity index 99% rename from test/tests/trainer/optimization/test_optimizers.py rename to test/unittests/trainer/optimization/test_optimizers.py index d60340bfeac87..a8dfed63d272f 100644 --- a/test/tests/trainer/optimization/test_optimizers.py +++ b/test/unittests/trainer/optimization/test_optimizers.py @@ -27,8 +27,8 @@ ) from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.types import LRSchedulerConfig -from tests.helpers.boring_model import BoringDataModule, BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringDataModule, BoringModel +from unittests.helpers.runif import RunIf def test_optimizer_with_scheduling(tmpdir): diff --git a/test/tests/trainer/properties/__init__.py b/test/unittests/trainer/properties/__init__.py similarity index 100% rename from test/tests/trainer/properties/__init__.py rename to test/unittests/trainer/properties/__init__.py diff --git a/test/tests/trainer/properties/test_auto_gpu_select.py b/test/unittests/trainer/properties/test_auto_gpu_select.py similarity index 98% rename from test/tests/trainer/properties/test_auto_gpu_select.py rename to test/unittests/trainer/properties/test_auto_gpu_select.py index 4413666ae3972..afe07f48880b8 100644 --- a/test/tests/trainer/properties/test_auto_gpu_select.py +++ b/test/unittests/trainer/properties/test_auto_gpu_select.py @@ -20,7 +20,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.tuner.auto_gpu_select import pick_multiple_gpus from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf @RunIf(min_cuda_gpus=2) diff --git a/test/tests/trainer/properties/test_estimated_stepping_batches.py b/test/unittests/trainer/properties/test_estimated_stepping_batches.py similarity index 97% rename from test/tests/trainer/properties/test_estimated_stepping_batches.py rename to test/unittests/trainer/properties/test_estimated_stepping_batches.py index 203aaff65ef53..523f3bbf5fa35 100644 --- a/test/tests/trainer/properties/test_estimated_stepping_batches.py +++ b/test/unittests/trainer/properties/test_estimated_stepping_batches.py @@ -23,9 +23,9 @@ from pytorch_lightning.callbacks.gradient_accumulation_scheduler import GradientAccumulationScheduler from pytorch_lightning.strategies.ipu import IPUStrategy from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomIterableDataset -from tests.helpers.runif import RunIf -from tests.helpers.utils import pl_multi_process_test +from unittests.helpers.boring_model import BoringModel, RandomIterableDataset +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import pl_multi_process_test def test_num_stepping_batches_basic(): diff --git a/test/tests/trainer/properties/test_get_model.py b/test/unittests/trainer/properties/test_get_model.py similarity index 95% rename from test/tests/trainer/properties/test_get_model.py rename to test/unittests/trainer/properties/test_get_model.py index e7fa5df3352c8..8eb23ff72a5bb 100644 --- a/test/tests/trainer/properties/test_get_model.py +++ b/test/unittests/trainer/properties/test_get_model.py @@ -13,8 +13,8 @@ # limitations under the License. from pytorch_lightning import Trainer -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf class TrainerGetModel(BoringModel): diff --git a/test/tests/trainer/properties/test_log_dir.py b/test/unittests/trainer/properties/test_log_dir.py similarity index 98% rename from test/tests/trainer/properties/test_log_dir.py rename to test/unittests/trainer/properties/test_log_dir.py index db2f862f82e7b..9567957704baf 100644 --- a/test/tests/trainer/properties/test_log_dir.py +++ b/test/unittests/trainer/properties/test_log_dir.py @@ -16,7 +16,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.loggers import CSVLogger, TensorBoardLogger -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel class TestModel(BoringModel): diff --git a/test/tests/trainer/properties/test_loggers.py b/test/unittests/trainer/properties/test_loggers.py similarity index 98% rename from test/tests/trainer/properties/test_loggers.py rename to test/unittests/trainer/properties/test_loggers.py index ac3a01cba3698..f0c17920c46af 100644 --- a/test/tests/trainer/properties/test_loggers.py +++ b/test/unittests/trainer/properties/test_loggers.py @@ -16,7 +16,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.loggers import LoggerCollection, TensorBoardLogger -from tests.loggers.test_logger import CustomLogger +from unittests.loggers.test_logger import CustomLogger def test_trainer_loggers_property(): diff --git a/test/tests/trainer/test_config_validator.py b/test/unittests/trainer/test_config_validator.py similarity index 99% rename from test/tests/trainer/test_config_validator.py rename to test/unittests/trainer/test_config_validator.py index 92e67c7e1dde6..26414e9339444 100644 --- a/test/tests/trainer/test_config_validator.py +++ b/test/unittests/trainer/test_config_validator.py @@ -18,7 +18,7 @@ from pytorch_lightning.callbacks.callback import Callback from pytorch_lightning.demos.boring_classes import BoringDataModule from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel, RandomDataset +from unittests.helpers import BoringModel, RandomDataset def test_wrong_train_setting(tmpdir): diff --git a/test/tests/trainer/test_dataloaders.py b/test/unittests/trainer/test_dataloaders.py similarity index 99% rename from test/tests/trainer/test_dataloaders.py rename to test/unittests/trainer/test_dataloaders.py index 27667f7b2e043..d4b2b257b977c 100644 --- a/test/tests/trainer/test_dataloaders.py +++ b/test/unittests/trainer/test_dataloaders.py @@ -28,9 +28,14 @@ from pytorch_lightning.trainer.states import RunningStage from pytorch_lightning.utilities.data import _auto_add_worker_init_fn, has_iterable_dataset, has_len_all_ranks from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset, RandomIterableDatasetWithLen -from tests.helpers.dataloaders import CustomInfDataloader, CustomNotImplementedErrorDataloader -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import ( + BoringModel, + RandomDataset, + RandomIterableDataset, + RandomIterableDatasetWithLen, +) +from unittests.helpers.dataloaders import CustomInfDataloader, CustomNotImplementedErrorDataloader +from unittests.helpers.runif import RunIf class MultiValDataLoaderBoringModel(BoringModel): diff --git a/test/tests/trainer/test_progress.py b/test/unittests/trainer/test_progress.py similarity index 100% rename from test/tests/trainer/test_progress.py rename to test/unittests/trainer/test_progress.py diff --git a/test/tests/trainer/test_states.py b/test/unittests/trainer/test_states.py similarity index 98% rename from test/tests/trainer/test_states.py rename to test/unittests/trainer/test_states.py index b6b7e44722fb2..a456d9e554cab 100644 --- a/test/tests/trainer/test_states.py +++ b/test/unittests/trainer/test_states.py @@ -15,7 +15,7 @@ from pytorch_lightning import Callback, Trainer from pytorch_lightning.trainer.states import RunningStage, TrainerFn, TrainerState, TrainerStatus -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_initialize_state(): diff --git a/test/tests/trainer/test_supporters.py b/test/unittests/trainer/test_supporters.py similarity index 99% rename from test/tests/trainer/test_supporters.py rename to test/unittests/trainer/test_supporters.py index ccf74b6fe9f47..690fec004695a 100644 --- a/test/tests/trainer/test_supporters.py +++ b/test/unittests/trainer/test_supporters.py @@ -36,8 +36,8 @@ from pytorch_lightning.utilities.auto_restart import CaptureMapDataset, FastForwardSampler from pytorch_lightning.utilities.data import get_len from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf def test_tensor_running_accum_reset(): diff --git a/test/tests/trainer/test_trainer.py b/test/unittests/trainer/test_trainer.py similarity index 99% rename from test/tests/trainer/test_trainer.py rename to test/unittests/trainer/test_trainer.py index 8e4f812a24ec1..8663d6cb13d30 100644 --- a/test/tests/trainer/test_trainer.py +++ b/test/unittests/trainer/test_trainer.py @@ -33,7 +33,7 @@ from torch.utils.data import DataLoader, IterableDataset import pytorch_lightning -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Callback, LightningDataModule, LightningModule, Trainer from pytorch_lightning.accelerators import CPUAccelerator, GPUAccelerator from pytorch_lightning.callbacks import EarlyStopping, GradientAccumulationScheduler, ModelCheckpoint, Timer @@ -57,11 +57,11 @@ from pytorch_lightning.utilities.exceptions import DeadlockDetectedException, MisconfigurationException from pytorch_lightning.utilities.imports import _OMEGACONF_AVAILABLE from pytorch_lightning.utilities.seed import seed_everything -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.boring_model import RandomIterableDataset, RandomIterableDatasetWithLen -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.runif import RunIf -from tests.helpers.simple_models import ClassificationModel +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.boring_model import RandomIterableDataset, RandomIterableDatasetWithLen +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.runif import RunIf +from unittests.helpers.simple_models import ClassificationModel if _OMEGACONF_AVAILABLE: from omegaconf import OmegaConf diff --git a/test/tests/trainer/test_trainer_cli.py b/test/unittests/trainer/test_trainer_cli.py similarity index 99% rename from test/tests/trainer/test_trainer_cli.py rename to test/unittests/trainer/test_trainer_cli.py index 37a02e895d560..f3f03201694a2 100644 --- a/test/tests/trainer/test_trainer_cli.py +++ b/test/unittests/trainer/test_trainer_cli.py @@ -19,7 +19,7 @@ import pytest import torch -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.utilities import argparse diff --git a/test/tests/tuner/__init__.py b/test/unittests/tuner/__init__.py similarity index 100% rename from test/tests/tuner/__init__.py rename to test/unittests/tuner/__init__.py diff --git a/test/tests/tuner/test_lr_finder.py b/test/unittests/tuner/test_lr_finder.py similarity index 98% rename from test/tests/tuner/test_lr_finder.py rename to test/unittests/tuner/test_lr_finder.py index daf2ecde2cc16..77cb389c0e72f 100644 --- a/test/tests/tuner/test_lr_finder.py +++ b/test/unittests/tuner/test_lr_finder.py @@ -19,10 +19,10 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringModel -from tests.helpers.datamodules import ClassifDataModule -from tests.helpers.simple_models import ClassificationModel -from tests.helpers.utils import no_warning_call +from unittests.helpers import BoringModel +from unittests.helpers.datamodules import ClassifDataModule +from unittests.helpers.simple_models import ClassificationModel +from unittests.helpers.utils import no_warning_call def test_error_on_more_than_1_optimizer(tmpdir): diff --git a/test/tests/tuner/test_scale_batch_size.py b/test/unittests/tuner/test_scale_batch_size.py similarity index 98% rename from test/tests/tuner/test_scale_batch_size.py rename to test/unittests/tuner/test_scale_batch_size.py index d22162dd948d3..93e6c9182da41 100644 --- a/test/tests/tuner/test_scale_batch_size.py +++ b/test/unittests/tuner/test_scale_batch_size.py @@ -18,14 +18,14 @@ import torch from torch.utils.data import DataLoader -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Trainer from pytorch_lightning.tuner.tuning import Tuner from pytorch_lightning.utilities import AMPType from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers import BoringDataModule, BoringModel, RandomDataset -from tests.helpers.runif import RunIf -from tests.helpers.utils import no_warning_call +from unittests.helpers import BoringDataModule, BoringModel, RandomDataset +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import no_warning_call class BatchSizeDataModule(BoringDataModule): diff --git a/test/tests/tuner/test_tuning.py b/test/unittests/tuner/test_tuning.py similarity index 95% rename from test/tests/tuner/test_tuning.py rename to test/unittests/tuner/test_tuning.py index aadacb6440fc2..8748c592b78ed 100644 --- a/test/tests/tuner/test_tuning.py +++ b/test/unittests/tuner/test_tuning.py @@ -15,7 +15,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel +from unittests.helpers.boring_model import BoringModel def test_tuner_with_distributed_strategies(): diff --git a/test/tests/utilities/__init__.py b/test/unittests/utilities/__init__.py similarity index 100% rename from test/tests/utilities/__init__.py rename to test/unittests/utilities/__init__.py diff --git a/test/tests/utilities/distributed.py b/test/unittests/utilities/distributed.py similarity index 100% rename from test/tests/utilities/distributed.py rename to test/unittests/utilities/distributed.py diff --git a/test/tests/utilities/test_all_gather_grad.py b/test/unittests/utilities/test_all_gather_grad.py similarity index 98% rename from test/tests/utilities/test_all_gather_grad.py rename to test/unittests/utilities/test_all_gather_grad.py index c10a3626ad6d8..949fdb3926de0 100644 --- a/test/tests/utilities/test_all_gather_grad.py +++ b/test/unittests/utilities/test_all_gather_grad.py @@ -19,8 +19,8 @@ from pytorch_lightning import seed_everything, Trainer from pytorch_lightning.utilities import AllGatherGrad -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf def setup_ddp(rank, world_size): diff --git a/test/tests/utilities/test_apply_func.py b/test/unittests/utilities/test_apply_func.py similarity index 100% rename from test/tests/utilities/test_apply_func.py rename to test/unittests/utilities/test_apply_func.py diff --git a/test/tests/utilities/test_apply_func_torchtext.py b/test/unittests/utilities/test_apply_func_torchtext.py similarity index 94% rename from test/tests/utilities/test_apply_func_torchtext.py rename to test/unittests/utilities/test_apply_func_torchtext.py index f76c1bf70cced..c5386f97f1868 100644 --- a/test/tests/utilities/test_apply_func_torchtext.py +++ b/test/unittests/utilities/test_apply_func_torchtext.py @@ -16,8 +16,8 @@ from pytorch_lightning.utilities.apply_func import move_data_to_device from pytorch_lightning.utilities.imports import _TORCHTEXT_LEGACY -from tests.helpers.runif import RunIf -from tests.helpers.torchtext_utils import get_dummy_torchtext_data_iterator +from unittests.helpers.runif import RunIf +from unittests.helpers.torchtext_utils import get_dummy_torchtext_data_iterator @pytest.mark.parametrize("include_lengths", [False, True]) diff --git a/test/tests/utilities/test_argparse.py b/test/unittests/utilities/test_argparse.py similarity index 100% rename from test/tests/utilities/test_argparse.py rename to test/unittests/utilities/test_argparse.py diff --git a/test/tests/utilities/test_auto_restart.py b/test/unittests/utilities/test_auto_restart.py similarity index 99% rename from test/tests/utilities/test_auto_restart.py rename to test/unittests/utilities/test_auto_restart.py index 2849aee531f18..8de569319be34 100644 --- a/test/tests/utilities/test_auto_restart.py +++ b/test/unittests/utilities/test_auto_restart.py @@ -36,7 +36,7 @@ from torch.utils.data.dataset import Dataset, IterableDataset from torch.utils.data.sampler import Sampler -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning import Callback, LightningModule, seed_everything, Trainer from pytorch_lightning.trainer.states import RunningStage, TrainerState from pytorch_lightning.trainer.supporters import CombinedLoader @@ -59,8 +59,8 @@ from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.fetching import DataFetcher from pytorch_lightning.utilities.imports import _fault_tolerant_training -from tests.helpers.boring_model import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf # Credit to PyTorch Team. diff --git a/test/tests/utilities/test_cli.py b/test/unittests/utilities/test_cli.py similarity index 99% rename from test/tests/utilities/test_cli.py rename to test/unittests/utilities/test_cli.py index c31e65db33680..1d690be8e6017 100644 --- a/test/tests/utilities/test_cli.py +++ b/test/unittests/utilities/test_cli.py @@ -53,9 +53,9 @@ ) from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.imports import _TORCHVISION_AVAILABLE -from tests.helpers import BoringDataModule, BoringModel -from tests.helpers.runif import RunIf -from tests.helpers.utils import no_warning_call +from unittests.helpers import BoringDataModule, BoringModel +from unittests.helpers.runif import RunIf +from unittests.helpers.utils import no_warning_call torchvision_version = version.parse("0") if _TORCHVISION_AVAILABLE: diff --git a/test/tests/utilities/test_cloud_io.py b/test/unittests/utilities/test_cloud_io.py similarity index 100% rename from test/tests/utilities/test_cloud_io.py rename to test/unittests/utilities/test_cloud_io.py diff --git a/test/tests/utilities/test_data.py b/test/unittests/utilities/test_data.py similarity index 98% rename from test/tests/utilities/test_data.py rename to test/unittests/utilities/test_data.py index ced076540b970..a4aaf17337a57 100644 --- a/test/tests/utilities/test_data.py +++ b/test/unittests/utilities/test_data.py @@ -19,8 +19,8 @@ warning_cache, ) from pytorch_lightning.utilities.exceptions import MisconfigurationException -from tests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset -from tests.helpers.utils import no_warning_call +from unittests.helpers.boring_model import BoringModel, RandomDataset, RandomIterableDataset +from unittests.helpers.utils import no_warning_call def test_extract_batch_size(): diff --git a/test/tests/utilities/test_deepspeed_collate_checkpoint.py b/test/unittests/utilities/test_deepspeed_collate_checkpoint.py similarity index 95% rename from test/tests/utilities/test_deepspeed_collate_checkpoint.py rename to test/unittests/utilities/test_deepspeed_collate_checkpoint.py index dac0db4a74be7..ba3cce04ba2db 100644 --- a/test/tests/utilities/test_deepspeed_collate_checkpoint.py +++ b/test/unittests/utilities/test_deepspeed_collate_checkpoint.py @@ -18,8 +18,8 @@ from pytorch_lightning import Trainer from pytorch_lightning.strategies import DeepSpeedStrategy from pytorch_lightning.utilities.deepspeed import convert_zero_checkpoint_to_fp32_state_dict -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf @RunIf(min_cuda_gpus=2, standalone=True, deepspeed=True) diff --git a/test/tests/utilities/test_distributed.py b/test/unittests/utilities/test_distributed.py similarity index 94% rename from test/tests/utilities/test_distributed.py rename to test/unittests/utilities/test_distributed.py index 269123b6ad4d4..f2abe391b350d 100644 --- a/test/tests/utilities/test_distributed.py +++ b/test/unittests/utilities/test_distributed.py @@ -16,9 +16,9 @@ import torch import torch.multiprocessing as mp -import tests.helpers.utils as tutils +import unittests.helpers.utils as tutils from pytorch_lightning.utilities.distributed import _collect_states_on_rank_zero -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf def _test_collect_states(rank, world_size): diff --git a/test/tests/utilities/test_dtype_device_mixin.py b/test/unittests/utilities/test_dtype_device_mixin.py similarity index 97% rename from test/tests/utilities/test_dtype_device_mixin.py rename to test/unittests/utilities/test_dtype_device_mixin.py index 21374384a7d50..44ddc89844b1e 100644 --- a/test/tests/utilities/test_dtype_device_mixin.py +++ b/test/unittests/utilities/test_dtype_device_mixin.py @@ -17,8 +17,8 @@ from pytorch_lightning import Callback, Trainer from pytorch_lightning.core.mixins import DeviceDtypeModuleMixin -from tests.helpers import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.runif import RunIf class SubSubModule(DeviceDtypeModuleMixin): diff --git a/test/tests/utilities/test_enums.py b/test/unittests/utilities/test_enums.py similarity index 100% rename from test/tests/utilities/test_enums.py rename to test/unittests/utilities/test_enums.py diff --git a/test/tests/utilities/test_fetching.py b/test/unittests/utilities/test_fetching.py similarity index 99% rename from test/tests/utilities/test_fetching.py rename to test/unittests/utilities/test_fetching.py index 2275400781a5b..eb1a7556c332f 100644 --- a/test/tests/utilities/test_fetching.py +++ b/test/unittests/utilities/test_fetching.py @@ -26,8 +26,8 @@ from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.fetching import DataFetcher, DataLoaderIterDataFetcher, InterBatchParallelDataFetcher from pytorch_lightning.utilities.types import STEP_OUTPUT -from tests.helpers import BoringModel, RandomDataset -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel, RandomDataset +from unittests.helpers.runif import RunIf class IterDataset(IterableDataset): diff --git a/test/tests/utilities/test_finite_checks.py b/test/unittests/utilities/test_finite_checks.py similarity index 100% rename from test/tests/utilities/test_finite_checks.py rename to test/unittests/utilities/test_finite_checks.py diff --git a/test/tests/utilities/test_grads.py b/test/unittests/utilities/test_grads.py similarity index 100% rename from test/tests/utilities/test_grads.py rename to test/unittests/utilities/test_grads.py diff --git a/test/tests/utilities/test_imports.py b/test/unittests/utilities/test_imports.py similarity index 100% rename from test/tests/utilities/test_imports.py rename to test/unittests/utilities/test_imports.py diff --git a/test/tests/utilities/test_logger.py b/test/unittests/utilities/test_logger.py similarity index 100% rename from test/tests/utilities/test_logger.py rename to test/unittests/utilities/test_logger.py diff --git a/test/tests/utilities/test_memory.py b/test/unittests/utilities/test_memory.py similarity index 97% rename from test/tests/utilities/test_memory.py rename to test/unittests/utilities/test_memory.py index b486157480877..d532a24da56ae 100644 --- a/test/tests/utilities/test_memory.py +++ b/test/unittests/utilities/test_memory.py @@ -17,7 +17,7 @@ import torch.nn as nn from pytorch_lightning.utilities.memory import get_model_size_mb, recursive_detach -from tests.helpers import BoringModel +from unittests.helpers import BoringModel def test_recursive_detach(): diff --git a/test/tests/utilities/test_meta.py b/test/unittests/utilities/test_meta.py similarity index 96% rename from test/tests/utilities/test_meta.py rename to test/unittests/utilities/test_meta.py index 4a3194961026d..a788b986b3e18 100644 --- a/test/tests/utilities/test_meta.py +++ b/test/unittests/utilities/test_meta.py @@ -16,8 +16,8 @@ from pytorch_lightning.core.module import LightningModule from pytorch_lightning.utilities.meta import init_meta_context, is_on_meta_device, materialize_module -from tests.helpers.boring_model import BoringModel -from tests.helpers.runif import RunIf +from unittests.helpers.boring_model import BoringModel +from unittests.helpers.runif import RunIf class MLP(nn.Module): diff --git a/test/tests/utilities/test_migration.py b/test/unittests/utilities/test_migration.py similarity index 100% rename from test/tests/utilities/test_migration.py rename to test/unittests/utilities/test_migration.py diff --git a/test/tests/utilities/test_model_helpers.py b/test/unittests/utilities/test_model_helpers.py similarity index 97% rename from test/tests/utilities/test_model_helpers.py rename to test/unittests/utilities/test_model_helpers.py index 74239becf506f..ebe7ad7d7c3e7 100644 --- a/test/tests/utilities/test_model_helpers.py +++ b/test/unittests/utilities/test_model_helpers.py @@ -18,7 +18,7 @@ from pytorch_lightning import LightningDataModule from pytorch_lightning.utilities.model_helpers import is_overridden -from tests.helpers import BoringDataModule, BoringModel +from unittests.helpers import BoringDataModule, BoringModel def test_is_overridden(): diff --git a/test/tests/utilities/test_model_summary.py b/test/unittests/utilities/test_model_summary.py similarity index 98% rename from test/tests/utilities/test_model_summary.py rename to test/unittests/utilities/test_model_summary.py index 9cf126aeaced8..30cbfc5b9bb4a 100644 --- a/test/tests/utilities/test_model_summary.py +++ b/test/unittests/utilities/test_model_summary.py @@ -20,9 +20,9 @@ from pytorch_lightning import LightningModule, Trainer from pytorch_lightning.utilities import _TORCH_GREATER_EQUAL_1_9 from pytorch_lightning.utilities.model_summary import ModelSummary, summarize, UNKNOWN_SIZE -from tests.helpers import BoringModel -from tests.helpers.advanced_models import ParityModuleRNN -from tests.helpers.runif import RunIf +from unittests.helpers import BoringModel +from unittests.helpers.advanced_models import ParityModuleRNN +from unittests.helpers.runif import RunIf class EmptyModule(LightningModule): diff --git a/test/tests/utilities/test_optimizer.py b/test/unittests/utilities/test_optimizer.py similarity index 100% rename from test/tests/utilities/test_optimizer.py rename to test/unittests/utilities/test_optimizer.py diff --git a/test/tests/utilities/test_parameter_tying.py b/test/unittests/utilities/test_parameter_tying.py similarity index 98% rename from test/tests/utilities/test_parameter_tying.py rename to test/unittests/utilities/test_parameter_tying.py index f0217c548b5a0..e8d455539b9d9 100644 --- a/test/tests/utilities/test_parameter_tying.py +++ b/test/unittests/utilities/test_parameter_tying.py @@ -16,7 +16,7 @@ from torch import nn from pytorch_lightning.utilities import find_shared_parameters, set_shared_parameters -from tests.helpers import BoringModel +from unittests.helpers import BoringModel class ParameterSharingModule(BoringModel): diff --git a/test/tests/utilities/test_parsing.py b/test/unittests/utilities/test_parsing.py similarity index 100% rename from test/tests/utilities/test_parsing.py rename to test/unittests/utilities/test_parsing.py diff --git a/test/tests/utilities/test_rank_zero.py b/test/unittests/utilities/test_rank_zero.py similarity index 100% rename from test/tests/utilities/test_rank_zero.py rename to test/unittests/utilities/test_rank_zero.py diff --git a/test/tests/utilities/test_remote_filesystem.py b/test/unittests/utilities/test_remote_filesystem.py similarity index 98% rename from test/tests/utilities/test_remote_filesystem.py rename to test/unittests/utilities/test_remote_filesystem.py index 75173a69ae84c..76e918a264aa6 100644 --- a/test/tests/utilities/test_remote_filesystem.py +++ b/test/unittests/utilities/test_remote_filesystem.py @@ -19,7 +19,7 @@ from pytorch_lightning import Trainer from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.loggers import TensorBoardLogger -from tests.helpers import BoringModel +from unittests.helpers import BoringModel GCS_BUCKET_PATH = os.getenv("GCS_BUCKET_PATH", None) _GCS_BUCKET_PATH_AVAILABLE = GCS_BUCKET_PATH is not None diff --git a/test/tests/utilities/test_seed.py b/test/unittests/utilities/test_seed.py similarity index 100% rename from test/tests/utilities/test_seed.py rename to test/unittests/utilities/test_seed.py diff --git a/test/tests/utilities/test_types.py b/test/unittests/utilities/test_types.py similarity index 100% rename from test/tests/utilities/test_types.py rename to test/unittests/utilities/test_types.py diff --git a/test/tests/utilities/test_upgrade_checkpoint.py b/test/unittests/utilities/test_upgrade_checkpoint.py similarity index 100% rename from test/tests/utilities/test_upgrade_checkpoint.py rename to test/unittests/utilities/test_upgrade_checkpoint.py diff --git a/test/tests/utilities/test_warnings.py b/test/unittests/utilities/test_warnings.py similarity index 100% rename from test/tests/utilities/test_warnings.py rename to test/unittests/utilities/test_warnings.py diff --git a/test/tests/utilities/test_xla_device_utils.py b/test/unittests/utilities/test_xla_device_utils.py similarity index 97% rename from test/tests/utilities/test_xla_device_utils.py rename to test/unittests/utilities/test_xla_device_utils.py index 8c1c92e7021c8..d69af561536ca 100644 --- a/test/tests/utilities/test_xla_device_utils.py +++ b/test/unittests/utilities/test_xla_device_utils.py @@ -18,7 +18,7 @@ import pytorch_lightning.utilities.xla_device as xla_utils from pytorch_lightning.utilities import _XLA_AVAILABLE -from tests.helpers.runif import RunIf +from unittests.helpers.runif import RunIf @pytest.mark.skipif(_XLA_AVAILABLE, reason="test requires torch_xla to be absent")