Skip to content

[Cherry-picks for 0.15] Various unit test fixes #7352

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

Merged
merged 4 commits into from
Feb 27, 2023
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
4 changes: 4 additions & 0 deletions test/test_extended_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ def test_naming_conventions(model_fn):
)
@run_if_test_with_extended
def test_schema_meta_validation(model_fn):

if model_fn.__name__ == "maskrcnn_resnet50_fpn_v2":
pytest.skip(reason="FIXME https://github.com/pytorch/vision/issues/7349")

# list of all possible supported high-level fields for weights meta-data
permitted_fields = {
"backend",
Expand Down
5 changes: 5 additions & 0 deletions test/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import random
import re
import sys
import textwrap
import warnings
from functools import partial
Expand Down Expand Up @@ -2278,6 +2279,10 @@ def test_random_grayscale_with_grayscale_input():
),
)
@pytest.mark.parametrize("from_private", (True, False))
@pytest.mark.skipif(
sys.platform in ("win32", "cygwin"),
reason="assert_run_python_script is broken on Windows. Possible fix in https://github.com/pytorch/vision/pull/7346",
)
def test_functional_deprecation_warning(import_statement, from_private):
if from_private:
import_statement = import_statement.replace("functional", "_functional")
Expand Down
9 changes: 9 additions & 0 deletions test/test_transforms_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pathlib
import random
import re
import sys
import textwrap
import warnings
from collections import defaultdict
Expand Down Expand Up @@ -2101,6 +2102,10 @@ def test_sanitize_bounding_boxes_errors():
),
)
@pytest.mark.parametrize("call_disable_warning", (True, False))
@pytest.mark.skipif(
sys.platform in ("win32", "cygwin"),
reason="assert_run_python_script is broken on Windows. Possible fix in https://github.com/pytorch/vision/pull/7346",
)
def test_warnings_v2_namespaces(import_statement, call_disable_warning):
if call_disable_warning:
source = f"""
Expand All @@ -2120,6 +2125,10 @@ def test_warnings_v2_namespaces(import_statement, call_disable_warning):
assert_run_python_script(textwrap.dedent(source))


@pytest.mark.skipif(
sys.platform in ("win32", "cygwin"),
reason="assert_run_python_script is broken on Windows. Possible fix in https://github.com/pytorch/vision/pull/7346",
)
def test_no_warnings_v1_namespace():
source = """
import warnings
Expand Down
10 changes: 10 additions & 0 deletions test/transforms_v2_kernel_infos.py
Original file line number Diff line number Diff line change
Expand Up @@ -1925,6 +1925,9 @@ def sample_inputs_adjust_contrast_video():
yield ArgsKwargs(video_loader, contrast_factor=_ADJUST_CONTRAST_FACTORS[0])


# TODO: this is just temporary to make CI green for release. We should add proper tolerances after
skip_adjust_contrast_jit = TestMark(("TestKernels", "test_scripted_vs_eager"), pytest.mark.skip(reason="Test is flaky"))

KERNEL_INFOS.extend(
[
KernelInfo(
Expand All @@ -1939,11 +1942,13 @@ def sample_inputs_adjust_contrast_video():
**float32_vs_uint8_pixel_difference(2),
**cuda_vs_cpu_pixel_difference(),
},
test_marks=[skip_adjust_contrast_jit],
),
KernelInfo(
F.adjust_contrast_video,
sample_inputs_fn=sample_inputs_adjust_contrast_video,
closeness_kwargs=cuda_vs_cpu_pixel_difference(),
test_marks=[skip_adjust_contrast_jit],
),
]
)
Expand Down Expand Up @@ -2059,6 +2064,9 @@ def sample_inputs_adjust_saturation_video():
yield ArgsKwargs(video_loader, saturation_factor=_ADJUST_SATURATION_FACTORS[0])


# TODO: this is just temporary to make CI green for release. We should add proper tolerances after
skip_adjust_saturation_cuda = TestMark(("TestKernels", "test_cuda_vs_cpu"), pytest.mark.skip(reason="Test is flaky"))

KERNEL_INFOS.extend(
[
KernelInfo(
Expand All @@ -2072,10 +2080,12 @@ def sample_inputs_adjust_saturation_video():
**pil_reference_pixel_difference(),
**float32_vs_uint8_pixel_difference(2),
},
test_marks=[skip_adjust_saturation_cuda],
),
KernelInfo(
F.adjust_saturation_video,
sample_inputs_fn=sample_inputs_adjust_saturation_video,
test_marks=[skip_adjust_saturation_cuda],
),
]
)
Expand Down