aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar pcloudy <pcloudy@google.com>2017-08-17 15:52:45 +0200
committerGravatar Irina Iancu <elenairina@google.com>2017-08-18 09:00:49 +0200
commit2b56fd95411dddf29e144c89b2788d0f3acd0677 (patch)
tree044977db675cd32903b562e266bd90388bed3800
parentaa8cc6c0a67b046ed15b1d985622436eb950eecb (diff)
test_base.py: use self._test_cwd to calculate temporary file path
Otherwise different test cases will share the same workspace. RELNOTES: None. PiperOrigin-RevId: 165572991
-rw-r--r--src/test/py/bazel/test_base.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/test/py/bazel/test_base.py b/src/test/py/bazel/test_base.py
index cabbeaf47e..fe228c9d15 100644
--- a/src/test/py/bazel/test_base.py
+++ b/src/test/py/bazel/test_base.py
@@ -94,10 +94,11 @@ class TestBase(unittest.TestCase):
return os.name == 'nt'
def Path(self, path):
- """Returns the absolute path of `path` relative to the scratch directory.
+ """Returns the absolute path of `path` relative to self._test_cwd.
Args:
- path: string; a path, relative to the test's scratch directory,
+ path: string; a path, relative to self._test_cwd,
+ self._test_cwd is different for each test case.
e.g. "foo/bar/BUILD"
Returns:
an absolute path
@@ -107,7 +108,7 @@ class TestBase(unittest.TestCase):
if os.path.isabs(path) or '..' in path:
raise ArgumentError(('path="%s" may not be absolute and may not contain '
'uplevel references') % path)
- return os.path.join(self._tests_root, path)
+ return os.path.join(self._test_cwd, path)
def Rlocation(self, runfile):
"""Returns the absolute path to a runfile."""