opennel-pymanager/tests/test_pycodestyle.py

36 lines
1.2 KiB
Python

#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# check code style
# Copyright (C) 2017 AleaJactaEst
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import unittest
try:
import pycodestyle
except ImportError:
import pep8 as pycodestyle
class TestPythonCodeStyle(unittest.TestCase):
def test_python_code_style(self):
style = pycodestyle.StyleGuide(quiet=False, config_file='setup.cfg')
result = style.check_files(['pymanager'])
self.assertEqual(result.total_errors, 0,
"Found code style errors (and warnings).")
if __name__ == '__main__':
unittest.main()