From 315dd68b001eeae3789dd8a9c5d435b005d91dba Mon Sep 17 00:00:00 2001
From: Philip Meier <github.pmeier@posteo.de>
Date: Mon, 27 Feb 2023 16:24:10 +0100
Subject: [PATCH] skip tests that use assert_run_python_script on windows

---
 test/test_transforms.py    | 5 +++++
 test/test_transforms_v2.py | 9 +++++++++
 2 files changed, 14 insertions(+)

diff --git a/test/test_transforms.py b/test/test_transforms.py
index 03b385e9edd..b6eccba421b 100644
--- a/test/test_transforms.py
+++ b/test/test_transforms.py
@@ -2,6 +2,7 @@
 import os
 import random
 import re
+import sys
 import textwrap
 import warnings
 from functools import partial
@@ -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")
diff --git a/test/test_transforms_v2.py b/test/test_transforms_v2.py
index f5ca976963a..9fe7bbf51f2 100644
--- a/test/test_transforms_v2.py
+++ b/test/test_transforms_v2.py
@@ -2,6 +2,7 @@
 import pathlib
 import random
 import re
+import sys
 import textwrap
 import warnings
 from collections import defaultdict
@@ -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"""
@@ -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