Пример #1
0
 def test_basic(self):
     log_testing_instance = LogTesting.setUp(self)
     logger = logging.getLogger('test.logger')
     logger.info('my message')
     log_testing_instance.assertMessages(['INFO: my message\n'])
     # The list of messages is cleared after being checked once.
     log_testing_instance.assertMessages([])
Пример #2
0
 def test_basic(self):
     log_testing_instance = LogTesting.setUp(self)
     logger = logging.getLogger('test.logger')
     logger.info('my message')
     log_testing_instance.assertMessages(['INFO: my message\n'])
     # The list of messages is cleared after being checked once.
     log_testing_instance.assertMessages([])
Пример #3
0
    def test_missing_builders_for_some_configurations(self):
        """Tests the behavior when there are no builders for some configurations.

        We don't necessarily expect to have builders for all configurations,
        so as long as a test appears to be non-flaky on all matching configurations
        that have builders, then it can be removed, even if there are extra
        configurations with no existing builders.
        """
        # Set the logging level used for assertLog to allow us to check all messages,
        # even messages with a "debug" severity level.
        self._log = LogTesting.setUp(self, logging_level=logging.DEBUG)

        test_expectations_before = """
            # There are no builders that match this configuration at all.
            Bug(test) [ Win ] test/a.html [ Failure Pass ]

            # This matches the existing linux release builder and
            # also linux debug, which has no builder.
            Bug(test) [ Linux ] test/b.html [ Failure Pass ]

            # No message should be emitted for this one because it's not
            # marked as flaky, so we don't need to check builder results.
            Bug(test) test/c.html [ Failure ]

            # This one is marked as flaky and there are some matching
            # configurations with no builders, but for all configurations
            # with existing builders, it is non-flaky.
            Bug(test) test/d.html [ Failure Pass ]

            # This one only matches the existing linux release builder,
            # and it's still flaky, so it shouldn't be removed.
            Bug(test) [ Linux Release ] test/e.html [ Failure Pass ]"""

        self._define_builders({
            "WebKit Linux Precise": {
                "port_name": "linux-precise",
                "specifiers": ['Precise', 'Release']
            },
        })

        self._port.all_build_types = ('release', 'debug')
        self._port.all_systems = (
            ('win7', 'x86'),
            ('precise', 'x86_64'),
        )

        self._parse_expectations(test_expectations_before)
        self._expectation_factory._all_results_by_builder = {
            'WebKit Linux Precise': {
                "test/a.html": ["PASS", "PASS", "PASS"],
                "test/b.html": ["PASS", "PASS", "PASS"],
                "test/c.html": ["PASS", "IMAGE", "PASS"],
                "test/d.html": ["PASS", "PASS", "PASS"],
                "test/e.html": ["PASS", "IMAGE", "PASS"],
            }
        }

        updated_expectations = (
            self._flake_remover.get_updated_test_expectations())

        self.assertLog([
            'DEBUG: No builder with config <win7, x86, release>\n',
            'DEBUG: No builder with config <win7, x86, debug>\n',
            'WARNING: No matching builders for line, deleting line.\n',
            'INFO: Deleting line "Bug(test) [ Win ] test/a.html [ Failure Pass ]"\n',
            'DEBUG: No builder with config <precise, x86_64, debug>\n',
            'DEBUG: Checked builders:\n  WebKit Linux Precise\n',
            'INFO: Deleting line "Bug(test) [ Linux ] test/b.html [ Failure Pass ]"\n',
            'DEBUG: No builder with config <win7, x86, release>\n',
            'DEBUG: No builder with config <win7, x86, debug>\n',
            'DEBUG: No builder with config <precise, x86_64, debug>\n',
            'DEBUG: Checked builders:\n  WebKit Linux Precise\n',
            'INFO: Deleting line "Bug(test) test/d.html [ Failure Pass ]"\n',
        ])
        self._assert_expectations_match(
            updated_expectations, """
            # No message should be emitted for this one because it's not
            # marked as flaky, so we don't need to check builder results.
            Bug(test) test/c.html [ Failure ]

            # This one only matches the existing linux release builder,
            # and it's still flaky, so it shouldn't be removed.
            Bug(test) [ Linux Release ] test/e.html [ Failure Pass ]""")
Пример #4
0
    def test_missing_builders_for_some_configurations(self):
        """Tests the behavior when there are no builders for some configurations.

        We don't necessarily expect to have builders for all configurations,
        so as long as a test appears to be non-flaky on all matching configurations
        that have builders, then it can be removed, even if there are extra
        configurations with no existing builders.
        """
        # Set the logging level used for assertLog to allow us to check all messages,
        # even messages with a "debug" severity level.
        self._log = LogTesting.setUp(self, logging_level=logging.DEBUG)

        test_expectations_before = """
            # There are no builders that match this configuration at all.
            Bug(test) [ Win ] test/a.html [ Failure Pass ]

            # This matches the existing linux release builder and
            # also linux debug, which has no builder.
            Bug(test) [ Linux ] test/b.html [ Failure Pass ]

            # No message should be emitted for this one because it's not
            # marked as flaky, so we don't need to check builder results.
            Bug(test) test/c.html [ Failure ]

            # This one is marked as flaky and there are some matching
            # configurations with no builders, but for all configurations
            # with existing builders, it is non-flaky.
            Bug(test) test/d.html [ Failure Pass ]

            # This one only matches the existing linux release builder,
            # and it's still flaky, so it shouldn't be removed.
            Bug(test) [ Linux Release ] test/e.html [ Failure Pass ]"""

        self._define_builders({
            "WebKit Linux Trusty": {
                "port_name": "linux-trusty",
                "specifiers": ['Trusty', 'Release']
            },
        })

        self._port.all_build_types = ('release', 'debug')
        self._port.all_systems = (
            ('win7', 'x86'),
            ('trusty', 'x86_64'),
        )

        self._parse_expectations(test_expectations_before)
        self._expectation_factory._all_results_by_builder = {
            'WebKit Linux Trusty': {
                "test/a.html": ["PASS", "PASS", "PASS"],
                "test/b.html": ["PASS", "PASS", "PASS"],
                "test/c.html": ["PASS", "IMAGE", "PASS"],
                "test/d.html": ["PASS", "PASS", "PASS"],
                "test/e.html": ["PASS", "IMAGE", "PASS"],
            }
        }

        updated_expectations = (
            self._flake_remover.get_updated_test_expectations())

        self.assertLog([
            'DEBUG: No builder with config <win7, x86, release>\n',
            'DEBUG: No builder with config <win7, x86, debug>\n',
            'WARNING: No matching builders for line, deleting line.\n',
            'INFO: Deleting line "Bug(test) [ Win ] test/a.html [ Failure Pass ]"\n',
            'DEBUG: No builder with config <trusty, x86_64, debug>\n',
            'DEBUG: Checked builders:\n  WebKit Linux Trusty\n',
            'INFO: Deleting line "Bug(test) [ Linux ] test/b.html [ Failure Pass ]"\n',
            'DEBUG: No builder with config <trusty, x86_64, debug>\n',
            'DEBUG: No builder with config <win7, x86, release>\n',
            'DEBUG: No builder with config <win7, x86, debug>\n',
            'DEBUG: Checked builders:\n  WebKit Linux Trusty\n',
            'INFO: Deleting line "Bug(test) test/d.html [ Failure Pass ]"\n',
        ])
        self._assert_expectations_match(
            updated_expectations,
            """
            # No message should be emitted for this one because it's not
            # marked as flaky, so we don't need to check builder results.
            Bug(test) test/c.html [ Failure ]

            # This one only matches the existing linux release builder,
            # and it's still flaky, so it shouldn't be removed.
            Bug(test) [ Linux Release ] test/e.html [ Failure Pass ]""")
Пример #5
0
 def setUp(self):
     self._log = LogTesting.setUp(self)
     self.filesystem = MockFileSystem(
         dirs=[self._original_directory, self._checkout_root],
         cwd=self._original_directory)
 def setUp(self):
     self._log = LogTesting.setUp(self)
Пример #7
0
 def setUp(self):
     self._log = LogTesting.setUp(self)
     self.filesystem = MockFileSystem(dirs=[self._original_directory, self._checkout_root], cwd=self._original_directory)
Пример #8
0
 def setUp(self):
     self._log = LogTesting.setUp(self)
     self._mock_os = self._MockOs(self)
Пример #9
0
 def setUp(self):
     self._log = LogTesting.setUp(self)
     self._mock_os = self._MockOs(self)
Пример #10
0
 def setUp(self):
     self._log = LogTesting.setUp(self)
Пример #11
0
 def test_log_level_warning(self):
     log_testing_instance = LogTesting.setUp(self, logging_level=logging.WARNING)
     logger = logging.getLogger('test.logger')
     logger.info('my message')
     log_testing_instance.assertMessages([])
Пример #12
0
 def test_log_level_warning(self):
     log_testing_instance = LogTesting.setUp(self,
                                             logging_level=logging.WARNING)
     logger = logging.getLogger('test.logger')
     logger.info('my message')
     log_testing_instance.assertMessages([])