Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: client/tests/run_isolated_test.py

Issue 2875113002: Revert "named caches: move instead of symlinking" (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/tests/named_cache_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/tests/run_isolated_test.py
diff --git a/client/tests/run_isolated_test.py b/client/tests/run_isolated_test.py
index d34e8aafaaff16a5ee25f0c708f05f87f7ef1ce5..41965707a16e72abed58e1bbdef7ecec4a243044 100755
--- a/client/tests/run_isolated_test.py
+++ b/client/tests/run_isolated_test.py
@@ -71,19 +71,6 @@ def init_named_caches_stub(_run_dir):
yield
-def put_to_named_cache(manager, cache_name, file_name, contents):
- """Puts files into named cache."""
- tdir = tempfile.mkdtemp(prefix=u'run_isolated_test')
- try:
- cache_dir = os.path.join(tdir, 'cache')
- manager.install(cache_dir, cache_name)
- with open(os.path.join(cache_dir, file_name), 'wb') as f:
- f.write(contents)
- manager.uninstall(cache_dir, cache_name)
- finally:
- file_path.rmtree(tdir)
-
-
class StorageFake(object):
def __init__(self, files):
self._files = files.copy()
@@ -546,12 +533,12 @@ class RunIsolatedTest(RunIsolatedTestBase):
ret = run_isolated.main(cmd)
self.assertEqual(0, ret)
- for cache_name in ('cache_foo', 'cache_bar'):
- named_path = os.path.join(self.tempdir, 'c', 'named', cache_name)
- self.assertTrue(os.path.exists(named_path))
+ for path, cache_name in [('foo', 'cache_foo'), ('bar', 'cache_bar')]:
self.assertEqual(
- os.path.join(self.tempdir, 'c'),
- os.path.dirname(os.readlink(named_path)),
+ os.path.abspath(os.readlink(
+ os.path.join(self.tempdir, 'ir', path))),
+ os.path.abspath(os.readlink(
+ os.path.join(self.tempdir, 'c', 'named', cache_name))),
)
def test_modified_cwd(self):
@@ -623,9 +610,13 @@ class RunIsolatedTest(RunIsolatedTestBase):
isolate_cache.write(small_digest, [small])
with named_cache_manager.open(time_fn=lambda: fake_time):
fake_time = 1
- put_to_named_cache(named_cache_manager, u'first', u'big', big)
+ p = named_cache_manager.request('first')
+ with open(os.path.join(p, 'big'), 'wb') as f:
+ f.write(big)
fake_time = 3
- put_to_named_cache(named_cache_manager, u'second', u'small', small)
+ p = named_cache_manager.request('second')
+ with open(os.path.join(p, 'small'), 'wb') as f:
+ f.write(small)
# Ensures the cache contain the expected data.
actual = genTree(np)
« no previous file with comments | « client/tests/named_cache_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698