X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/da8a5bb1895e5434695d9dc2d844119cd8f88524..cbf5401efff0524f7395c5fb81551de75b17c89e:/tests/test_black.py diff --git a/tests/test_black.py b/tests/test_black.py index 1fc63c9..5647a00 100644 --- a/tests/test_black.py +++ b/tests/test_black.py @@ -50,6 +50,7 @@ from tests.util import ( DATA_DIR, DEFAULT_MODE, DETERMINISTIC_HEADER, + PROJECT_ROOT, PY36_VERSIONS, THIS_DIR, BlackBaseTestCase, @@ -1512,9 +1513,11 @@ class BlackTestCase(BlackBaseTestCase): """ with patch.object(black, "parse_pyproject_toml", return_value={}) as parse: args = ["--code", "print"] - CliRunner().invoke(black.main, args) + # This is the only directory known to contain a pyproject.toml + with change_directory(PROJECT_ROOT): + CliRunner().invoke(black.main, args) + pyproject_path = Path(Path.cwd(), "pyproject.toml").resolve() - pyproject_path = Path(Path().cwd(), "pyproject.toml").resolve() assert ( len(parse.mock_calls) >= 1 ), "Expected config parse to be called with the current directory." @@ -1529,7 +1532,7 @@ class BlackTestCase(BlackBaseTestCase): Test that the code option finds the pyproject.toml in the parent directory. """ with patch.object(black, "parse_pyproject_toml", return_value={}) as parse: - with change_directory(Path("tests")): + with change_directory(THIS_DIR): args = ["--code", "print"] CliRunner().invoke(black.main, args)