From 25fdbe6b27888b7ccf1284c0304a8eb282dbb428 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Wed, 8 Mar 2023 12:33:23 -0800 Subject: [PATCH] use tmpdir instead of isolated_filesystem, refs #2037 Should hopefully get tests passing for #2036 too. --- tests/test_cli.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 9adcd752..75724f61 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -179,14 +179,13 @@ def test_install_upgrade(run_module, flag): @mock.patch("datasette.cli.run_module") -def test_install_requirements(run_module): +def test_install_requirements(run_module, tmpdir): + path = tmpdir.join("requirements.txt") + path.write("datasette-mock-plugin\ndatasette-plugin-2") runner = CliRunner() - with runner.isolated_filesystem(): - with open("requirements.txt", "w") as fp: - fp.write("datasette-mock-plugin\ndatasette-plugin-2") - runner.invoke(cli, ["install", "-r", "requirements.txt"]) + runner.invoke(cli, ["install", "-r", str(path)]) run_module.assert_called_once_with("pip", run_name="__main__") - assert sys.argv == ["pip", "install", "-r", "requirements.txt"] + assert sys.argv == ["pip", "install", "-r", str(path)] def test_install_error_if_no_packages():