From 733447d7c71805efe6189f728a0f620e239fe4ac Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Fri, 18 Nov 2022 16:44:46 -0800 Subject: [PATCH] Upgrade to Python 3.11 on Heroku, refs #1905 --- datasette/publish/heroku.py | 2 +- tests/test_publish_heroku.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/datasette/publish/heroku.py b/datasette/publish/heroku.py index 2b8977f1..f576a346 100644 --- a/datasette/publish/heroku.py +++ b/datasette/publish/heroku.py @@ -194,7 +194,7 @@ def temporary_heroku_directory( fp.write(json.dumps(metadata_content, indent=2)) with open("runtime.txt", "w") as fp: - fp.write("python-3.8.10") + fp.write("python-3.11.0") if branch: install = [ diff --git a/tests/test_publish_heroku.py b/tests/test_publish_heroku.py index faab340e..cab83654 100644 --- a/tests/test_publish_heroku.py +++ b/tests/test_publish_heroku.py @@ -133,8 +133,15 @@ def test_publish_heroku_plugin_secrets( @pytest.mark.serial @mock.patch("shutil.which") -def test_publish_heroku_generate_dir(mock_which, tmp_path_factory): +@mock.patch("datasette.publish.heroku.check_output") +@mock.patch("datasette.publish.heroku.call") +def test_publish_heroku_generate_dir( + mock_call, mock_check_output, mock_which, tmp_path_factory +): mock_which.return_value = True + mock_check_output.side_effect = lambda s: { + "['heroku', 'plugins']": b"heroku-builds", + }[repr(s)] runner = CliRunner() os.chdir(tmp_path_factory.mktemp("runner")) with open("test.db", "w") as fp: @@ -163,7 +170,7 @@ def test_publish_heroku_generate_dir(mock_which, tmp_path_factory): } for name, expected in ( ("requirements.txt", "datasette"), - ("runtime.txt", "python-3.8.10"), + ("runtime.txt", "python-3.11.0"), ( "Procfile", (