message: Add xfail marking support to backend test runner
diff: @@ -58,6 +58,7 @@ class Runner(object):
  self._parent_module = parent_module
  self._include_patterns = set() # type: Set[Pattern[Text]]
  self._exclude_patterns = set() # type: Set[Pattern[Text]]
  + self._xfail_patterns = set() # type: Set[Pattern[Text]]
  # This is the source of the truth of all test functions.
  # Properties `test_cases`, `test_suite` and `tests` will be
  @@ -94,6 +95,10 @@ class Runner(object):
  self._exclude_patterns.add(re.compile(pattern))
  return self
  + def xfail(self, pattern): # type: (Text) -> Runner
  + self._xfail_patterns.add(re.compile(pattern))
  + return self
  +
  def enable_report(self): # type: () -> Runner
  import pytest # type: ignore
  @@ -120,6 +125,9 @@ class Runner(object):
  'matched exclude pattern "{}"'.format(
  exclude.pattern)
  )(item.func)
  + for xfail in self._xfail_patterns:
  + if xfail.search(name):
  + item.func = unittest.expectedFailure(item.func)
  filtered[category][name] = item
  return filtered
  