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

Fix test skipping for windows platform and avoid skipping MacOS #3548

Merged
merged 3 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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: 2 additions & 2 deletions test/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def test_fashionmnist(self, mock_download_extract):
self.assertEqual(dataset.class_to_idx[dataset.classes[0]], target)

@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:
Expand All @@ -166,7 +166,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:

Expand Down
8 changes: 4 additions & 4 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down