From ad2eb319a00f3f31f5c3467e44df87ac65e191cc Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Thu, 11 Mar 2021 14:51:41 +0000 Subject: [PATCH] better cond --- test/test_datasets.py | 4 ++-- test/test_utils.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/test_datasets.py b/test/test_datasets.py index 56f0d6707bc..e024f50677d 100644 --- a/test/test_datasets.py +++ b/test/test_datasets.py @@ -157,7 +157,7 @@ def test_imagenet(self, mock_verify): self.generic_classification_dataset_test(dataset) @mock.patch('torchvision.datasets.WIDERFace._check_integrity') - @unittest.skipIf('win' in sys.platform, 'temporarily disabled on Windows') + @unittest.skipIf(sys.platform in ('win32', 'cygwin'), 'temporarily disabled on Windows') def test_widerface(self, mock_check_integrity): mock_check_integrity.return_value = True with widerface_root() as root: @@ -176,7 +176,7 @@ def test_widerface(self, mock_check_integrity): img, target = dataset[0] self.assertTrue(isinstance(img, PIL.Image.Image)) - @unittest.skipIf('win' in sys.platform, 'temporarily disabled on Windows') + @unittest.skipIf(sys.platform in ('win32', 'cygwin'), 'temporarily disabled on Windows') def test_cityscapes(self): with cityscapes_root() as root: diff --git a/test/test_utils.py b/test/test_utils.py index 662ad2a0cce..1fcee7ce489 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -42,21 +42,21 @@ def test_normalize_in_make_grid(self): self.assertTrue(torch.equal(norm_max, rounded_grid_max), 'Normalized max is not equal to 1') self.assertTrue(torch.equal(norm_min, rounded_grid_min), 'Normalized min is not equal to 0') - @unittest.skipIf('win' in sys.platform, 'temporarily disabled on Windows') + @unittest.skipIf(sys.platform in ('win32', 'cygwin'), 'temporarily disabled on Windows') def test_save_image(self): with tempfile.NamedTemporaryFile(suffix='.png') as f: t = torch.rand(2, 3, 64, 64) utils.save_image(t, f.name) self.assertTrue(os.path.exists(f.name), 'The image is not present after save') - @unittest.skipIf('win' in sys.platform, 'temporarily disabled on Windows') + @unittest.skipIf(sys.platform in ('win32', 'cygwin'), 'temporarily disabled on Windows') def test_save_image_single_pixel(self): with tempfile.NamedTemporaryFile(suffix='.png') as f: t = torch.rand(1, 3, 1, 1) utils.save_image(t, f.name) self.assertTrue(os.path.exists(f.name), 'The pixel image is not present after save') - @unittest.skipIf('win' in sys.platform, 'temporarily disabled on Windows') + @unittest.skipIf(sys.platform in ('win32', 'cygwin'), 'temporarily disabled on Windows') def test_save_image_file_object(self): with tempfile.NamedTemporaryFile(suffix='.png') as f: t = torch.rand(2, 3, 64, 64) @@ -68,7 +68,7 @@ def test_save_image_file_object(self): self.assertTrue(torch.equal(F.to_tensor(img_orig), F.to_tensor(img_bytes)), 'Image not stored in file object') - @unittest.skipIf('win' in sys.platform, 'temporarily disabled on Windows') + @unittest.skipIf(sys.platform in ('win32', 'cygwin'), 'temporarily disabled on Windows') def test_save_image_single_pixel_file_object(self): with tempfile.NamedTemporaryFile(suffix='.png') as f: t = torch.rand(1, 3, 1, 1)