From 98d3d50295c3e686913e4c01ca0de2c523aae33b Mon Sep 17 00:00:00 2001 From: "Eric N. Vander Weele" Date: Sun, 12 Jan 2020 16:26:26 -0800 Subject: [PATCH] tests: Ensure patched `os.getcwd()` is an absolute path `os.getcwd()` returns an absolute path; thus, the patched paths should be absolute as well. This is an incremental change towards removing the `ConfigFileFinder` attributes `.parent` and `.tail` to be localized to `.generate_possible_local_files()`. Without this, the tests fail when moving the patching because `os.path.abspath()` calls `os.getcwd()`, expecting `os.getcwd()` to be an absolute path. --- tests/unit/test_config_file_finder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/test_config_file_finder.py b/tests/unit/test_config_file_finder.py index 44da8d4..c0231f8 100644 --- a/tests/unit/test_config_file_finder.py +++ b/tests/unit/test_config_file_finder.py @@ -48,15 +48,15 @@ def test_cli_config_double_read(): @pytest.mark.parametrize('cwd,expected', [ # Root directory of project - ('.', + (os.path.abspath('.'), [os.path.abspath('setup.cfg'), os.path.abspath('tox.ini')]), # Subdirectory of project directory - ('src', + (os.path.abspath('src'), [os.path.abspath('setup.cfg'), os.path.abspath('tox.ini')]), # Outside of project directory - ('/', + (os.path.abspath('/'), []), ]) def test_generate_possible_local_files(cwd, expected):