Exemplo n.º 1
0
    def __init__(self, test, job):
        """
        @param test: The autotest test to create this task from.
        @param job: The job info that owns this task.
        """
        self._test = test
        self._job = job

        keyvals_file = os.path.join(self.results_dir, 'keyval')
        self.keyvals = base_utils.read_keyval(keyvals_file)
Exemplo n.º 2
0
 def test_accesses_directories_through_keyval_file(self):
     os.path.isdir.expect_call("dir").and_return(True)
     self.create_test_file("dir/keyval", "")
     base_utils.read_keyval("dir")
     self.god.check_playback()
Exemplo n.º 3
0
 def test_accesses_files_directly(self):
     os.path.isdir.expect_call("file").and_return(False)
     self.create_test_file("file", "")
     base_utils.read_keyval("file")
     self.god.check_playback()
Exemplo n.º 4
0
 def test_returns_empty_when_file_doesnt_exist(self):
     os.path.isdir.expect_call("file").and_return(False)
     os.path.exists.expect_call("file").and_return(False)
     self.assertEqual({}, base_utils.read_keyval("file"))
     self.god.check_playback()
Exemplo n.º 5
0
 def read_keyval(self, contents):
     os.path.isdir.expect_call("file").and_return(False)
     self.create_test_file("file", contents)
     keyval = base_utils.read_keyval("file")
     self.god.check_playback()
     return keyval
Exemplo n.º 6
0
 def test_accesses_directories_through_keyval_file(self):
     os.path.isdir.expect_call("dir").and_return(True)
     self.create_test_file("dir/keyval", "")
     base_utils.read_keyval("dir")
     self.god.check_playback()
Exemplo n.º 7
0
 def test_accesses_files_directly(self):
     os.path.isdir.expect_call("file").and_return(False)
     self.create_test_file("file", "")
     base_utils.read_keyval("file")
     self.god.check_playback()
Exemplo n.º 8
0
 def test_returns_empty_when_file_doesnt_exist(self):
     os.path.isdir.expect_call("file").and_return(False)
     os.path.exists.expect_call("file").and_return(False)
     self.assertEqual({}, base_utils.read_keyval("file"))
     self.god.check_playback()
Exemplo n.º 9
0
 def read_keyval(self, contents):
     os.path.isdir.expect_call("file").and_return(False)
     self.create_test_file("file", contents)
     keyval = base_utils.read_keyval("file")
     self.god.check_playback()
     return keyval