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

Unified Diff: chrome/test/mini_installer/file_verifier.py

Issue 2747023002: Cleanup machine based on the state in configuration file for mini installer test.
Patch Set: fixup Created 3 years, 9 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
Index: chrome/test/mini_installer/file_verifier.py
diff --git a/chrome/test/mini_installer/file_verifier.py b/chrome/test/mini_installer/file_verifier.py
index 5e6244648a4c85701899b68997ce28b345f889ce..a4037a0a2463d9435e429f7baf4888c4b47cab56 100644
--- a/chrome/test/mini_installer/file_verifier.py
+++ b/chrome/test/mini_installer/file_verifier.py
@@ -10,6 +10,10 @@ import verifier
class FileVerifier(verifier.Verifier):
"""Verifies that the current files match the expectation dictionaries."""
+ def __init__(self):
+ self._file_path = None
+ self._file_exists = None
+
def _VerifyExpectation(self, expectation_name, expectation,
variable_expander):
"""Overridden from verifier.Verifier.
@@ -24,8 +28,8 @@ class FileVerifier(verifier.Verifier):
'exists' a boolean indicating whether the file should exist.
variable_expander: A VariableExpander object.
"""
- file_path = variable_expander.Expand(expectation_name)
- file_exists = os.path.exists(file_path)
- assert expectation['exists'] == file_exists, \
- ('File %s exists' % file_path) if file_exists else \
- ('File %s is missing' % file_path)
+ self._file_path = variable_expander.Expand(expectation_name)
grt (UTC plus 2) 2017/03/14 09:19:44 why store state in the verifier? one instance is u
+ self._file_exists = os.path.exists(self._file_path)
+ self._Assert(expectation['exists'] == self._file_exists,
+ ('File %s exists' % self._file_path) if self._file_exists \
+ else ('File %s is missing' % self._file_path))

Powered by Google App Engine
This is Rietveld 408576698