Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions .azure/gpu-tests-pytorch.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Python package
# Create and test a Python package on multiple Python versions.
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/python

trigger:
tags:
include: ["*"]
Expand All @@ -24,18 +19,18 @@ pr:
- "examples/run_pl_examples.sh"
- "examples/pytorch/basics/backbone_image_classifier.py"
- "examples/pytorch/basics/autoencoder.py"
- "requirements/fabric/**"
- "requirements/pytorch/**"
- "src/lightning/__init__.py"
- "src/lightning/__setup__.py"
- "src/lightning/__version__.py"
- "src/lightning/pytorch/**"
- "src/lightning_fabric/*"
- "src/lightning/fabric/**"
- "src/pytorch_lightning/*"
- "src/lightning/pytorch/**"
- "tests/tests_pytorch/**"
- "tests/run_standalone_*.sh"
- "pyproject.toml" # includes pytest config
- "requirements/fabric/**"
- "src/lightning/fabric/**"
- "src/lightning_fabric/*"
exclude:
- "requirements/*/docs.txt"
- "*.md"
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ ignore = [
"S607", # todo: Starting a process with a partial executable path
"RET504", # todo:Unnecessary variable assignment before `return` statement
"PT004", # todo: Fixture `tmpdir_unittest_fixture` does not return anything, add leading underscore
"PT011", # todo: `pytest.raises(ValueError)` is too broad, set the `match` parameter or use a more specific exception
"PT012", # todo: `pytest.raises()` block should contain a single simple statement
"PT019", # todo: Fixture `_` without value is injected as parameter, use `@pytest.mark.usefixtures` instead
]
Expand Down
10 changes: 5 additions & 5 deletions tests/tests_pytorch/loggers/test_neptune.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,19 @@ def test_online_with_wrong_kwargs(neptune_mock):
init."""
run = neptune_mock.init_run()

with pytest.raises(ValueError):
with pytest.raises(ValueError, match="Run parameter expected to be of type `neptune.Run`*"):
NeptuneLogger(run="some string")

with pytest.raises(ValueError):
with pytest.raises(ValueError, match="When an already initialized run object is provided*"):
NeptuneLogger(run=run, project="redundant project")

with pytest.raises(ValueError):
with pytest.raises(ValueError, match="When an already initialized run object is provided*"):
NeptuneLogger(run=run, api_key="redundant api key")

with pytest.raises(ValueError):
with pytest.raises(ValueError, match="When an already initialized run object is provided*"):
NeptuneLogger(run=run, name="redundant api name")

with pytest.raises(ValueError):
with pytest.raises(ValueError, match="When an already initialized run object is provided*"):
NeptuneLogger(run=run, foo="random **kwarg")

# this should work
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_pytorch/models/test_hparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def __init__(self, arg1, arg2):
)
def test_single_config_models_fail(tmp_path, cls, config):
"""Test fail on passing unsupported config type."""
with pytest.raises(ValueError):
with pytest.raises(ValueError, match=r"Primitives \(<class 'bool'>*"):
_ = cls(**config)


Expand Down
6 changes: 3 additions & 3 deletions tests/tests_pytorch/profilers/test_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ def test_simple_profiler_overhead(simple_profiler):
def test_simple_profiler_value_errors(simple_profiler):
"""Ensure errors are raised where expected."""
action = "test"
with pytest.raises(ValueError):
with pytest.raises(ValueError, match="Attempting to stop recording an action*"):
simple_profiler.stop(action)

simple_profiler.start(action)

with pytest.raises(ValueError):
with pytest.raises(ValueError, match="Attempted to start test*"):
simple_profiler.start(action)

simple_profiler.stop(action)
Expand Down Expand Up @@ -325,7 +325,7 @@ def test_advanced_profiler_dump_states(tmp_path):
def test_advanced_profiler_value_errors(advanced_profiler):
"""Ensure errors are raised where expected."""
action = "test"
with pytest.raises(ValueError):
with pytest.raises(ValueError, match="Attempting to stop recording*"):
advanced_profiler.stop(action)

advanced_profiler.start(action)
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_pytorch/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def test_lightning_cli_save_config_seed_everything(cleandir):


def test_save_to_log_dir_false_error():
with pytest.raises(ValueError):
with pytest.raises(ValueError, match="`save_to_log_dir=False` only makes sense*"):
SaveConfigCallback(
LightningArgumentParser(),
Namespace(),
Expand Down
Loading