summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorEric N. Vander Weele <ericvw@gmail.com>2020-01-12 16:37:25 -0800
committerEric N. Vander Weele <ericvw@gmail.com>2020-01-12 23:13:11 -0500
commite887ef33177b1d7617c6f1cf816e323886863b64 (patch)
tree0fa308bdffd1014d1eb07760474bc4a7c9c76e78 /tests/unit
parent98d3d50295c3e686913e4c01ca0de2c523aae33b (diff)
downloadflake8-e887ef33177b1d7617c6f1cf816e323886863b64.tar.gz
config: Remove ConfigFileFinder 'parent' and 'tail' attributes
These attributes are only needed within the `.generate_possible_local_files()` method. Therefore, just obtain the current working directory at the beginning of the method and reduce the lifetime state of the `ConfigFileFinder` object.
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test_config_file_finder.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/unit/test_config_file_finder.py b/tests/unit/test_config_file_finder.py
index c0231f8..d03118a 100644
--- a/tests/unit/test_config_file_finder.py
+++ b/tests/unit/test_config_file_finder.py
@@ -61,11 +61,12 @@ def test_cli_config_double_read():
])
def test_generate_possible_local_files(cwd, expected):
"""Verify generation of all possible config paths."""
+ finder = config.ConfigFileFinder('flake8', [])
+
with mock.patch.object(os, 'getcwd', return_value=cwd):
- finder = config.ConfigFileFinder('flake8', [])
+ config_files = list(finder.generate_possible_local_files())
- assert (list(finder.generate_possible_local_files())
- == expected)
+ assert config_files == expected
@pytest.mark.parametrize('extra_config_files,expected', [