Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: ignore::FutureWarning... #2448

Merged
merged 14 commits into from
Mar 15, 2024
5 changes: 3 additions & 2 deletions .azure/gpu-unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,15 @@ jobs:
displayName: "Show caches"

- bash: |
python -m pytest torchmetrics -s --cov=torchmetrics \
python -m pytest torchmetrics --cov=torchmetrics \
--timeout=240 --durations=50 \
--reruns 2 --reruns-delay 1
# --numprocesses=5 --dist=loadfile
env:
DOCTEST_DOWNLOAD_TIMEOUT: "180"
SKIP_SLOW_DOCTEST: "1"
workingDirectory: src
timeoutInMinutes: "40"
displayName: "DocTesting"

- bash: |
Expand All @@ -154,7 +155,7 @@ jobs:
displayName: "Pull testing data from S3"

- bash: |
python -m pytest $(TEST_DIRS) -v \
python -m pytest $(TEST_DIRS) \
-m "not DDP" --numprocesses=5 --dist=loadfile \
--cov=torchmetrics --timeout=240 --durations=100 \
--reruns 3 --reruns-delay 1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ jobs:
if: ${{ env.TEST_DIRS != '' }}
working-directory: ./tests
run: |
python -m pytest -v \
python -m pytest \
$TEST_DIRS \
--cov=torchmetrics \
--durations=50 \
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ addopts = [
markers = [
"DDP: mark a test as Distributed Data Parallel",
]
#filterwarnings = ["error::FutureWarning"] # ToDo
filterwarnings = [
"ignore::FutureWarning",
"default:::torchmetrics",
]
xfail_strict = true
junit_duration_report = "call"

Expand Down
6 changes: 6 additions & 0 deletions tests/unittests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os.path
import warnings
from typing import NamedTuple

import numpy
Expand Down Expand Up @@ -28,6 +29,11 @@

_reference_cachier = cachier(cache_dir=_PATH_TEST_CACHE, separate_files=True)

# ignore FutureWarnings while testing (mainly appearing with DDP runs)
warnings.filterwarnings("ignore", category=FutureWarning, module="sklearn.*")
warnings.filterwarnings("ignore", category=FutureWarning, module="transformers.*")
warnings.filterwarnings("ignore", category=UserWarning, module="sklearn.*")


if torch.cuda.is_available():
torch.backends.cuda.matmul.allow_tf32 = False
Expand Down
Loading