Esempio n. 1
0
	def load( commit, target, test ):
		""" Load test result

			raises:
				IOError: When the results files is removed while reading.

			returns:
				TestResult instance
		"""
		commit = git.describe( commit )
		fpath = os.path.join(
			config.STORAGE_DIR( test, commit=commit ),
			'result.json'
		)

		try:
			with open( fpath ) as results:
				data = json.load( results )

				result = TestResult.unserialize( test, data )
				result.test = test
		except IOError as e:
			# if the file did not exist, advice the user to run the test first
			if not os.path.exists( fpath ):
				raise ValueError( str( e ))
			else:
				raise

		logger.debug( "Loaded testresult: %s (commit: %s)" % ( str( result ), commit ))

		return result
Esempio n. 2
0
    def load(commit, target, test):
        """ Load test result

			raises:
				IOError: When the results files is removed while reading.

			returns:
				TestResult instance
		"""
        commit = git.describe(commit)
        fpath = os.path.join(config.STORAGE_DIR(test, commit=commit),
                             'result.json')

        try:
            with open(fpath) as results:
                data = json.load(results)

                result = TestResult.unserialize(test, data)
                result.test = test
        except IOError as e:
            # if the file did not exist, advice the user to run the test first
            if not os.path.exists(fpath):
                raise ValueError(str(e))
            else:
                raise

        logger.debug("Loaded testresult: %s (commit: %s)" %
                     (str(result), commit))

        return result