def register_configurations(self): current = time.time() old = current - 60 * 60 * 24 * 21 for configuration in self.CONFIGURATIONS: if (configuration.platform == 'Mac' and configuration.version <= Configuration.version_to_integer('10.13')) \ or (configuration.platform == 'iOS' and configuration.version <= Configuration.version_to_integer('11')): self.database.register_configuration(configuration, old) else: self.database.register_configuration(configuration, current)
def test_version_integer_conversion(self): self.assertEqual(1002003, Configuration.version_to_integer([1, 2, 3])) self.assertEqual(1000000, Configuration.version_to_integer([1])) self.assertEqual(1002003, Configuration.version_to_integer('1.2.3')) self.assertEqual(1000000, Configuration.version_to_integer('1')) self.assertEqual(1, Configuration.version_to_integer(1)) self.assertEqual('1.2.3', Configuration.integer_to_version(1002003)) self.assertEqual('1.2.0', Configuration.integer_to_version(1002000)) self.assertEqual('1.0.0', Configuration.integer_to_version(1000000)) self.assertEqual('0.1.2', Configuration.integer_to_version(1002)) self.assertEqual('0.0.1', Configuration.integer_to_version(1))
def add_mock_results(cls, model, configuration=Configuration(), suite='layout-tests', test_results=None): if test_results is None: test_results = cls.layout_test_results() configurations = [configuration] if configuration.is_complete( ) else ConfigurationContextTest.CONFIGURATIONS with model.upload_context: current = time.time() old = current - 60 * 60 * 24 * 21 for complete_configuration in configurations: if complete_configuration != configuration: continue timestamp_to_use = current if (complete_configuration.platform == 'Mac' and complete_configuration.version <= Configuration.version_to_integer('10.13')) \ or (complete_configuration.platform == 'iOS' and complete_configuration.version <= Configuration.version_to_integer('11')): timestamp_to_use = old cls.iterate_all_commits( model, lambda commits: model.upload_context. upload_test_results(complete_configuration, commits, suite=suite, test_results=test_results, timestamp=timestamp_to_use))
def add_mock_archives(cls, model, configuration=Configuration(), suite='layout-tests', archive=None): archive = archive or io.BytesIO(base64.b64decode(cls.ARCHIVE_ZIP)) configurations = [configuration] if configuration.is_complete( ) else ConfigurationContextTest.CONFIGURATIONS with model.upload_context: current = time.time() old = current - cls.THREE_WEEKS for complete_configuration in configurations: if complete_configuration != configuration: continue timestamp_to_use = current if (complete_configuration.platform == 'Mac' and complete_configuration.version <= Configuration.version_to_integer('10.13')) \ or (complete_configuration.platform == 'iOS' and complete_configuration.version <= Configuration.version_to_integer('11')): timestamp_to_use = old cls.iterate_all_commits( model, lambda commits: model.archive_context.register( archive, complete_configuration, commits, suite=suite, timestamp=timestamp_to_use))