From 8c872c4bb99c13d82b7b82db037eb3cb29a243e4 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Sun, 10 Jan 2016 14:47:06 -0600 Subject: [PATCH] Add more docstrings and fix lint errors --- setup.py | 2 ++ tests/unit/__init__.py | 0 tests/unit/test_merged_config_parser.py | 1 + tests/unit/test_notifier.py | 5 +++++ tests/unit/test_option.py | 1 + tests/unit/test_option_manager.py | 1 + tests/unit/test_trie.py | 1 + tests/unit/test_utils.py | 1 + tox.ini | 1 + 9 files changed, 13 insertions(+) delete mode 100644 tests/unit/__init__.py diff --git a/setup.py b/setup.py index 92ea08f..064b28e 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +"""Packaging logic for Flake8.""" # -*- coding: utf-8 -*- from __future__ import with_statement import setuptools @@ -25,6 +26,7 @@ if mock is None: def get_long_description(): + """Generate a long description from the README and CHANGES files.""" descr = [] for fname in ('README.rst', 'CHANGES.rst'): with open(fname) as f: diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/unit/test_merged_config_parser.py b/tests/unit/test_merged_config_parser.py index 96f6aae..8287d1b 100644 --- a/tests/unit/test_merged_config_parser.py +++ b/tests/unit/test_merged_config_parser.py @@ -10,6 +10,7 @@ from flake8.options import manager @pytest.fixture def optmanager(): + """Generate an OptionManager with simple values.""" return manager.OptionManager(prog='flake8', version='3.0.0a1') diff --git a/tests/unit/test_notifier.py b/tests/unit/test_notifier.py index b0365f3..84b8a45 100644 --- a/tests/unit/test_notifier.py +++ b/tests/unit/test_notifier.py @@ -1,7 +1,9 @@ +"""Unit tests for the Notifier object.""" import pytest from flake8 import notifier + class _Listener(object): def __init__(self, error_code): self.error_code = error_code @@ -13,8 +15,11 @@ class _Listener(object): class TestNotifier(object): + """Notifier unit tests.""" + @pytest.fixture(autouse=True) def setup(self): + """Set up each TestNotifier instance.""" self.notifier = notifier.Notifier() self.listener_map = {} diff --git a/tests/unit/test_option.py b/tests/unit/test_option.py index 55cae5c..5facf2a 100644 --- a/tests/unit/test_option.py +++ b/tests/unit/test_option.py @@ -60,5 +60,6 @@ def test_config_name_needs_long_option_name(): def test_dest_is_not_overridden(): + """Show that we do not override custom destinations.""" opt = manager.Option('-s', '--short', dest='something_not_short') assert opt.dest == 'something_not_short' diff --git a/tests/unit/test_option_manager.py b/tests/unit/test_option_manager.py index a9e641d..b0e4ee7 100644 --- a/tests/unit/test_option_manager.py +++ b/tests/unit/test_option_manager.py @@ -9,6 +9,7 @@ from flake8.options import manager @pytest.fixture def optmanager(): + """Generate a simple OptionManager with default test arguments.""" return manager.OptionManager(prog='flake8', version='3.0.0b1') diff --git a/tests/unit/test_trie.py b/tests/unit/test_trie.py index 0a5a0a9..4cbd8c5 100644 --- a/tests/unit/test_trie.py +++ b/tests/unit/test_trie.py @@ -1,3 +1,4 @@ +"""Unit test for the _trie module.""" from flake8 import _trie as trie diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index b0e243c..a6096d4 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -38,4 +38,5 @@ def test_normalize_path(value, expected): [os.path.abspath("../" + p) for p in RELATIVE_PATHS]), ]) def test_normalize_paths(value, expected): + """Verify we normalize comma-separated paths provided to the tool.""" assert utils.normalize_paths(value) == expected diff --git a/tox.ini b/tox.ini index 8d9d425..2267e15 100644 --- a/tox.ini +++ b/tox.ini @@ -9,4 +9,5 @@ commands = py.test {posargs} [flake8] +# Ignore some flake8-docstrings errors ignore = D203