File: style_test.py

package info (click to toggle)
forensic-artifacts 20190113-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 712 kB
  • sloc: python: 1,669; sh: 166; makefile: 21
file content (29 lines) | stat: -rw-r--r-- 781 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""Enforce code style."""

import subprocess
import unittest

from artifacts import errors

from tests import test_lib


class StyleTest(test_lib.BaseTestCase):
  """Enforce code style requirements."""

  @unittest.skip('yapf deployment need to be fixed')
  def testCodeStyle(self):
    """Check yapf style enforcement runs cleanly."""
    try:
      subprocess.check_output(
          ['yapf', '--diff', '-r', 'artifacts tools', 'artifacts', 'tests'])
    except subprocess.CalledProcessError as exception:
      if hasattr(exception, 'output'):
        raise errors.CodeStyleError(
            'Run "yapf -i -r artifacts tools/ artifacts/ tests/" to correct '
            'these problems: {0}'.format(exception.output))
      raise


if __name__ == '__main__':
  unittest.main()