diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 9b7582bd183d..24b1da2e0697 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -52,6 +52,15 @@ "group": "groupA" }, "problemMatcher": [] + }, + { + "label": "Run python tests", + "command": "make test", + "type": "shell", + "presentation": { + "reveal": "always" + }, + "problemMatcher": [] } ] } diff --git a/mealie/services/image/minify.py b/mealie/services/image/minify.py index 024656a50314..c6f781e3ae73 100644 --- a/mealie/services/image/minify.py +++ b/mealie/services/image/minify.py @@ -60,7 +60,10 @@ def move_all_images(): continue new_folder = app_dirs.IMG_DIR.joinpath(image_file.stem) new_folder.mkdir(parents=True, exist_ok=True) - image_file.rename(new_folder.joinpath(f"original{image_file.suffix}")) + new_file = new_folder.joinpath(f"original{image_file.suffix}") + if new_file.is_file(): + new_file.unlink() + image_file.rename(new_file) def validate_slugs_in_database(session: Session = None): diff --git a/tests/unit_tests/test_cleaner.py b/tests/unit_tests/test_cleaner.py index b1630a1324a9..dbe597281952 100644 --- a/tests/unit_tests/test_cleaner.py +++ b/tests/unit_tests/test_cleaner.py @@ -80,7 +80,7 @@ def test_cleaner_instructions(instructions): def test_html_with_recipe_data(): path = TEST_RAW_HTML.joinpath("healthy_pasta_bake_60759.html") url = "https://www.bbc.co.uk/food/recipes/healthy_pasta_bake_60759" - recipe_data = extract_recipe_from_html(open(path).read(), url) + recipe_data = extract_recipe_from_html(open(path,encoding="utf8").read(), url) assert len(recipe_data["name"]) > 10 assert len(recipe_data["slug"]) > 10