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.
This commit is contained in:
Eric N. Vander Weele 2020-01-12 16:26:26 -08:00
parent a5aa81e875
commit 98d3d50295

View file

@ -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):