Пример #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
Пример #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
Пример #3
0
class TestResultTestCase( unittest.TestCase ):
	"""Testcase for testing TestResults
	"""
	def setUp( self ):
		self.testresult = TestResult( TEST_MOCK, START_TIME, STOP_TIME,
									TARGET, commit=COMMIT )

	def test_serialize( self ):
		serialized = self.testresult.serialize()

		self.assertEqual( TEST_MOCK.name, serialized[ 'name' ] )
		self.assertEqual( START_TIME.isoformat( " " ), serialized[ 'started' ] )
		self.assertEqual( STOP_TIME.isoformat( " " ), serialized[ 'completed' ] )
		self.assertEqual( TARGET, serialized[ 'target' ] )
		self.assertEqual( COMMIT, serialized[ 'commit' ] )
Пример #4
0
class TestResultTestCase(unittest.TestCase):
    """Testcase for testing TestResults
	"""
    def setUp(self):
        self.testresult = TestResult(TEST_MOCK,
                                     START_TIME,
                                     STOP_TIME,
                                     TARGET,
                                     commit=COMMIT)

    def test_serialize(self):
        serialized = self.testresult.serialize()

        self.assertEqual(TEST_MOCK.name, serialized['name'])
        self.assertEqual(START_TIME.isoformat(" "), serialized['started'])
        self.assertEqual(STOP_TIME.isoformat(" "), serialized['completed'])
        self.assertEqual(TARGET, serialized['target'])
        self.assertEqual(COMMIT, serialized['commit'])
Пример #5
0
	def setUp( self ):
		self.testresult = TestResult( TEST_MOCK, START_TIME, STOP_TIME,
									TARGET, commit=COMMIT )
Пример #6
0
 def setUp(self):
     self.testresult = TestResult(TEST_MOCK,
                                  START_TIME,
                                  STOP_TIME,
                                  TARGET,
                                  commit=COMMIT)