@@ -77,6 +77,9 @@ class DatasetBuilderTestCase(parameterized.TestCase, test_utils.SubTestCase):
77
77
`download_and_extract` method. The values should be the path of files
78
78
present in the `fake_examples` directory, relative to that directory.
79
79
If not specified, path to `fake_examples` will always be returned.
80
+ EXAMPLE_DIR: `str`, the base directory in in which fake examples are
81
+ contained. Optional; defaults to
82
+ tensorflow_datasets/testing/test_data/fake_examples/<dataset name>.
80
83
OVERLAPPING_SPLITS: `list[str]`, splits containing examples from other
81
84
splits (e.g. a "example" split containing pictures from other splits).
82
85
MOCK_OUT_FORBIDDEN_OS_FUNCTIONS: `bool`, defaults to True. Set to False to
@@ -100,6 +103,7 @@ class DatasetBuilderTestCase(parameterized.TestCase, test_utils.SubTestCase):
100
103
DATASET_CLASS = None
101
104
BUILDER_CONFIG_NAMES_TO_TEST = []
102
105
DL_EXTRACT_RESULT = None
106
+ EXAMPLE_DIR = None
103
107
OVERLAPPING_SPLITS = []
104
108
MOCK_OUT_FORBIDDEN_OS_FUNCTIONS = True
105
109
@@ -117,9 +121,14 @@ def setUp(self):
117
121
super (DatasetBuilderTestCase , self ).setUp ()
118
122
self .patchers = []
119
123
self .builder = self ._make_builder ()
124
+
125
+ # Determine the fake_examples directory.
120
126
self .example_dir = os .path .join (
121
127
os .path .dirname (__file__ ),
122
128
"test_data/fake_examples/%s" % self .builder .name )
129
+ if self .EXAMPLE_DIR is not None :
130
+ self .example_dir = self .EXAMPLE_DIR
131
+
123
132
if not tf .io .gfile .exists (self .example_dir ):
124
133
err_msg = "fake_examples dir %s not found." % self .example_dir
125
134
raise ValueError (err_msg )
0 commit comments