testing/unexpected_passes_common/result_output_unittest.py
def testSemiStaleMap(self):
    """Tests that everything functions when regular data is provided."""
    expectation_map = data_types.TestExpectationMap({
        'expectation_file':
        data_types.ExpectationBuilderMap({
            data_types.Expectation('foo/test', ['win', 'intel'], [
                                       'RetryOnFailure'
                                   ]):
            data_types.BuilderStepMap({
                'builder':
                data_types.StepBuildStatsMap({
                    'all_pass':
                    uu.CreateStatsWithPassFails(2, 0),
                    'all_fail':
                    uu.CreateStatsWithPassFails(0, 2),
                    'some_pass':
                    uu.CreateStatsWithPassFails(1, 1),
                }),
            }),
            data_types.Expectation('foo/test', ['linux', 'intel'], [
                                       'RetryOnFailure'
                                   ]):
            data_types.BuilderStepMap({
                'builder':
                data_types.StepBuildStatsMap({
                    'all_pass':
                    uu.CreateStatsWithPassFails(2, 0),
                }),
            }),
            data_types.Expectation('foo/test', ['mac', 'intel'], [
                                       'RetryOnFailure'
                                   ]):
            data_types.BuilderStepMap({
                'builder':
                data_types.StepBuildStatsMap({
                    'all_fail':
                    uu.CreateStatsWithPassFails(0, 2),
                }),
            }),
        }),
    })
    # TODO(crbug.com/1198237): Remove the Python 2 version once we are fully
    # switched to Python 3.
    if six.PY2:
      expected_output = {
          'expectation_file': {
              'foo/test': {
                  '"RetryOnFailure" expectation on "win intel"': {
                      'builder': {
                          'Fully passed in the following': [
                              'all_pass (2/2 passed)',
                          ],
                          'Never passed in the following': [
                              'all_fail (0/2 passed)',
                          ],
                          'Partially passed in the following': {
                              'some_pass (1/2 passed)': [
                                  data_types.BuildLinkFromBuildId('build_id0'),
                              ],
                          },
                      },
                  },
                  '"RetryOnFailure" expectation on "intel linux"': {
                      'builder': {
                          'Fully passed in the following': [
                              'all_pass (2/2 passed)',
                          ],
                      },
                  },
                  '"RetryOnFailure" expectation on "mac intel"': {
                      'builder': {
                          'Never passed in the following': [
                              'all_fail (0/2 passed)',
                          ],
                      },
                  },
              },
          },
      }
    else:
      # Set ordering does not appear to be stable between test runs, as we can
      # get either order of tags. So, generate them now instead of hard coding
      # them.
      linux_tags = ' '.join(set(['linux', 'intel']))
      win_tags = ' '.join(set(['win', 'intel']))
      mac_tags = ' '.join(set(['mac', 'intel']))
      expected_output = {
          'expectation_file': {
              'foo/test': {
                  '"RetryOnFailure" expectation on "%s"' % linux_tags: {
                      'builder': {
                          'Fully passed in the following': [
                              'all_pass (2/2 passed)',
                          ],
                      },
                  },
                  '"RetryOnFailure" expectation on "%s"' % win_tags: {
                      'builder': {
                          'Fully passed in the following': [
                              'all_pass (2/2 passed)',
                          ],
                          'Partially passed in the following': {
                              'some_pass (1/2 passed)': [
                                  data_types.BuildLinkFromBuildId('build_id0'),
                              ],
                          },
                          'Never passed in the following': [
                              'all_fail (0/2 passed)',
                          ],
                      },
                  },
                  '"RetryOnFailure" expectation on "%s"' % mac_tags: {
                      'builder': {
                          'Never passed in the following': [
                              'all_fail (0/2 passed)',
                          ],
                      },
                  },
              },
          },
      }

    str_dict = result_output._ConvertTestExpectationMapToStringDict(
        expectation_map)
    self.assertEqual(str_dict, expected_output)
Tests that everything functions when regular data is provided.
Tests that everything functions when regular data is provided.
Tests that everything functions when regular data is provided .
def testSemiStaleMap(self):
    expectation_map = data_types.TestExpectationMap({
        'expectation_file':
        data_types.ExpectationBuilderMap({
            data_types.Expectation('foo/test', ['win', 'intel'], [
                                       'RetryOnFailure'
                                   ]):
            data_types.BuilderStepMap({
                'builder':
                data_types.StepBuildStatsMap({
                    'all_pass':
                    uu.CreateStatsWithPassFails(2, 0),
                    'all_fail':
                    uu.CreateStatsWithPassFails(0, 2),
                    'some_pass':
                    uu.CreateStatsWithPassFails(1, 1),
                }),
            }),
            data_types.Expectation('foo/test', ['linux', 'intel'], [
                                       'RetryOnFailure'
                                   ]):
            data_types.BuilderStepMap({
                'builder':
                data_types.StepBuildStatsMap({
                    'all_pass':
                    uu.CreateStatsWithPassFails(2, 0),
                }),
            }),
            data_types.Expectation('foo/test', ['mac', 'intel'], [
                                       'RetryOnFailure'
                                   ]):
            data_types.BuilderStepMap({
                'builder':
                data_types.StepBuildStatsMap({
                    'all_fail':
                    uu.CreateStatsWithPassFails(0, 2),
                }),
            }),
        }),
    })
    if six.PY2:
      expected_output = {
          'expectation_file': {
              'foo/test': {
                  '"RetryOnFailure" expectation on "win intel"': {
                      'builder': {
                          'Fully passed in the following': [
                              'all_pass (2/2 passed)',
                          ],
                          'Never passed in the following': [
                              'all_fail (0/2 passed)',
                          ],
                          'Partially passed in the following': {
                              'some_pass (1/2 passed)': [
                                  data_types.BuildLinkFromBuildId('build_id0'),
                              ],
                          },
                      },
                  },
                  '"RetryOnFailure" expectation on "intel linux"': {
                      'builder': {
                          'Fully passed in the following': [
                              'all_pass (2/2 passed)',
                          ],
                      },
                  },
                  '"RetryOnFailure" expectation on "mac intel"': {
                      'builder': {
                          'Never passed in the following': [
                              'all_fail (0/2 passed)',
                          ],
                      },
                  },
              },
          },
      }
    else:
      linux_tags = ' '.join(set(['linux', 'intel']))
      win_tags = ' '.join(set(['win', 'intel']))
      mac_tags = ' '.join(set(['mac', 'intel']))
      expected_output = {
          'expectation_file': {
              'foo/test': {
                  '"RetryOnFailure" expectation on "%s"' % linux_tags: {
                      'builder': {
                          'Fully passed in the following': [
                              'all_pass (2/2 passed)',
                          ],
                      },
                  },
                  '"RetryOnFailure" expectation on "%s"' % win_tags: {
                      'builder': {
                          'Fully passed in the following': [
                              'all_pass (2/2 passed)',
                          ],
                          'Partially passed in the following': {
                              'some_pass (1/2 passed)': [
                                  data_types.BuildLinkFromBuildId('build_id0'),
                              ],
                          },
                          'Never passed in the following': [
                              'all_fail (0/2 passed)',
                          ],
                      },
                  },
                  '"RetryOnFailure" expectation on "%s"' % mac_tags: {
                      'builder': {
                          'Never passed in the following': [
                              'all_fail (0/2 passed)',
                          ],
                      },
                  },
              },
          },
      }
    str_dict = result_output._ConvertTestExpectationMapToStringDict(
        expectation_map)
    self.assertEqual(str_dict, expected_output)
def testSemiStaleMap ( self ) : expectation_map = data_types . TestExpectationMap ( { 'expectation_file' : data_types . ExpectationBuilderMap ( { data_types . Expectation ( 'foo/test' , [ 'win' , 'intel' ] , [ 'RetryOnFailure' ] ) : data_types . BuilderStepMap ( { 'builder' : data_types . StepBuildStatsMap ( { 'all_pass' : uu . CreateStatsWithPassFails ( 2 , 0 ) , 'all_fail' : uu . CreateStatsWithPassFails ( 0 , 2 ) , 'some_pass' : uu . CreateStatsWithPassFails ( 1 , 1 ) , } ) , } ) , data_types . Expectation ( 'foo/test' , [ 'linux' , 'intel' ] , [ 'RetryOnFailure' ] ) : data_types . BuilderStepMap ( { 'builder' : data_types . StepBuildStatsMap ( { 'all_pass' : uu . CreateStatsWithPassFails ( 2 , 0 ) , } ) , } ) , data_types . Expectation ( 'foo/test' , [ 'mac' , 'intel' ] , [ 'RetryOnFailure' ] ) : data_types . BuilderStepMap ( { 'builder' : data_types . StepBuildStatsMap ( { 'all_fail' : uu . CreateStatsWithPassFails ( 0 , 2 ) , } ) , } ) , } ) , } ) if six . PY2 : expected_output = { 'expectation_file' : { 'foo/test' : { '"RetryOnFailure" expectation on "win intel"' : { 'builder' : { 'Fully passed in the following' : [ 'all_pass (2/2 passed)' , ] , 'Never passed in the following' : [ 'all_fail (0/2 passed)' , ] , 'Partially passed in the following' : { 'some_pass (1/2 passed)' : [ data_types . BuildLinkFromBuildId ( 'build_id0' ) , ] , } , } , } , '"RetryOnFailure" expectation on "intel linux"' : { 'builder' : { 'Fully passed in the following' : [ 'all_pass (2/2 passed)' , ] , } , } , '"RetryOnFailure" expectation on "mac intel"' : { 'builder' : { 'Never passed in the following' : [ 'all_fail (0/2 passed)' , ] , } , } , } , } , } else : linux_tags = ' ' . join ( set ( [ 'linux' , 'intel' ] ) ) win_tags = ' ' . join ( set ( [ 'win' , 'intel' ] ) ) mac_tags = ' ' . join ( set ( [ 'mac' , 'intel' ] ) ) expected_output = { 'expectation_file' : { 'foo/test' : { '"RetryOnFailure" expectation on "%s"' % linux_tags : { 'builder' : { 'Fully passed in the following' : [ 'all_pass (2/2 passed)' , ] , } , } , '"RetryOnFailure" expectation on "%s"' % win_tags : { 'builder' : { 'Fully passed in the following' : [ 'all_pass (2/2 passed)' , ] , 'Partially passed in the following' : { 'some_pass (1/2 passed)' : [ data_types . BuildLinkFromBuildId ( 'build_id0' ) , ] , } , 'Never passed in the following' : [ 'all_fail (0/2 passed)' , ] , } , } , '"RetryOnFailure" expectation on "%s"' % mac_tags : { 'builder' : { 'Never passed in the following' : [ 'all_fail (0/2 passed)' , ] , } , } , } , } , } str_dict = result_output . _ConvertTestExpectationMapToStringDict ( expectation_map ) self . assertEqual ( str_dict , expected_output )
Tests that everything functions when regular data is provided.
Tests that everything functions when regular data is provided .
"""Tests that everything functions when regular data is provided.""" # TODO(crbug.com/1198237): Remove the Python 2 version once we are fully # switched to Python 3. # Set ordering does not appear to be stable between test runs, as we can # get either order of tags. So, generate them now instead of hard coding # them.
self