Skip data loading error in multi_worker_tutorial_test (the test does not aim to cover this).

PiperOrigin-RevId: 317797271
Change-Id: I8336d7ffeda0836beef0a2d04e633614a44e7fa4
This commit is contained in:
Rick Chao 2020-06-22 21:41:24 -07:00 committed by Geeta Chavan
parent f9ca9abe78
commit 48064efcfd
1 changed files with 3 additions and 0 deletions

View File

@ -19,6 +19,7 @@ from __future__ import print_function
import contextlib import contextlib
import os import os
import re import re
import zipfile
from absl.testing import parameterized from absl.testing import parameterized
import numpy as np import numpy as np
from tensorflow.python import keras from tensorflow.python import keras
@ -43,6 +44,8 @@ class MultiWorkerTutorialTest(parameterized.TestCase, test.TestCase):
def skip_fetch_failure_exception(self): def skip_fetch_failure_exception(self):
try: try:
yield yield
except zipfile.BadZipfile as e:
self.skipTest('Data loading error: Bad magic number for file header.')
except Exception as e: # pylint: disable=broad-except except Exception as e: # pylint: disable=broad-except
if 'URL fetch failure' in str(e): if 'URL fetch failure' in str(e):
self.skipTest('URL fetch error not considered failure of the test.') self.skipTest('URL fetch error not considered failure of the test.')