message: Make sure each saved model test is executed in its own directory.
diff: @@ -19,6 +19,7 @@ from __future__ import division
  from __future__ import print_function
  import os
  +import tempfile
  from absl.testing import parameterized
  import numpy as np
  @@ -154,8 +155,8 @@ class TestSavedModelBase(test.TestCase, parameterized.TestCase):
  distribution, run_distributed):
  """Save a model without DS, and restore it with DS."""
  - saved_dir = os.path.join(self.get_temp_dir(), self._root_dir,
  - 'test_save_no_dist_restore_dist')
  + saved_dir = os.path.join(tempfile.mkdtemp(dir=self.get_temp_dir()),
  + self._root_dir, 'test_save_no_dist_restore_dist')
  model, output_name = model_and_input.get_model(
  run_distributed=run_distributed)
  @@ -182,8 +183,8 @@ class TestSavedModelBase(test.TestCase, parameterized.TestCase):
  run_distributed):
  """Save a model with DS, and restore it without DS."""
  - saved_dir = os.path.join(self.get_temp_dir(), self._root_dir,
  - 'test_save_no_dist_restore_dist')
  + saved_dir = os.path.join(tempfile.mkdtemp(dir=self.get_temp_dir()),
  + self._root_dir, 'test_save_no_dist_restore_dist')
  with distribution.scope():
  model, output_name = model_and_input.get_model(
  @@ -215,8 +216,8 @@ class TestSavedModelBase(test.TestCase, parameterized.TestCase):
  save_in_scope, run_distributed):
  """Save a model with DS, and restore it with potentially different DS."""
  - saved_dir = os.path.join(self.get_temp_dir(), self._root_dir,
  - 'test_save_dist_restore_dist')
  + saved_dir = os.path.join(tempfile.mkdtemp(dir=self.get_temp_dir()),
  + self._root_dir, 'test_save_dist_restore_dist')
  with distribution_for_saving.scope():
  model, output_name = model_and_input.get_model(
  