move deprecation test to correct 1.6 test file (#8446)

* move deprecation test to correct 1.6 test file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update tests/deprecated_api/test_remove_1-6.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
This commit is contained in:
Adrian Wälchli 2021-07-19 12:46:03 +02:00 committed by GitHub
parent 1bfa29a8b0
commit 999ef5cb48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 15 deletions

View File

@ -15,25 +15,10 @@
import pytest
from pytorch_lightning import Trainer
from tests.deprecated_api import _soft_unimport_module
from tests.helpers import BoringModel
def test_v1_4_0_deprecated_imports():
_soft_unimport_module('pytorch_lightning.utilities.argparse_utils')
with pytest.deprecated_call(match='will be removed in v1.4'):
from pytorch_lightning.utilities.argparse_utils import _gpus_arg_default # noqa: F811 F401
def test_v1_4_0_deprecated_hpc_load(tmpdir):
model = BoringModel()
trainer = Trainer(
default_root_dir=tmpdir,
max_steps=1,
)
trainer.fit(model)
trainer.checkpoint_connector.hpc_save(tmpdir, trainer.logger)
checkpoint_path = trainer.checkpoint_connector.get_max_ckpt_path_from_folder(str(tmpdir))
with pytest.deprecated_call(match=r"`CheckpointConnector.hpc_load\(\)` was deprecated in v1.4"):
trainer.checkpoint_connector.hpc_load(checkpoint_path)

View File

@ -309,3 +309,16 @@ def test_v1_6_0_deprecated_disable_validation():
def test_v1_6_0_every_n_val_epochs():
with pytest.deprecated_call(match="use `every_n_epochs` instead"):
_ = ModelCheckpoint(every_n_val_epochs=1)
def test_v1_6_0_deprecated_hpc_load(tmpdir):
model = BoringModel()
trainer = Trainer(
default_root_dir=tmpdir,
max_steps=1,
)
trainer.fit(model)
trainer.checkpoint_connector.hpc_save(tmpdir, trainer.logger)
checkpoint_path = trainer.checkpoint_connector.get_max_ckpt_path_from_folder(str(tmpdir))
with pytest.deprecated_call(match=r"`CheckpointConnector.hpc_load\(\)` was deprecated in v1.4"):
trainer.checkpoint_connector.hpc_load(checkpoint_path)