From 85ef1d9b4380d50cabdd92e034ecb05ba4cb5319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20D=C3=B6rfelt?= Date: Sat, 21 Sep 2024 13:08:58 +0200 Subject: [PATCH] make manual test script cross-platform compatible --- test/example_commands.sh | 53 ------------------------------------ test/manual_test.py | 59 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 53 deletions(-) delete mode 100755 test/example_commands.sh create mode 100644 test/manual_test.py diff --git a/test/example_commands.sh b/test/example_commands.sh deleted file mode 100755 index f0c1461c..00000000 --- a/test/example_commands.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -# for manual testing - -set -e - -mkdir -p "tmp_output" -pushd "tmp_output" - -CACHE="../.cache" # created at a testsuite run - -EXECUTABLE="${1:-python ../src/jimmy_cli.py}" -echo "Running with $EXECUTABLE" - -$EXECUTABLE "$CACHE/arbitrary_folder" -$EXECUTABLE "$CACHE/arbitrary_folder" "$CACHE/arbitrary_folder" -$EXECUTABLE "$CACHE/bear/backup.bear2bk" --format bear -$EXECUTABLE "$CACHE/cacher/cacher-export-202406182304.json" --format cacher -$EXECUTABLE "$CACHE/cherrytree/cherry.ctb.ctd" --format cherrytree -$EXECUTABLE "$CACHE/clipto/clipto_backup_240401_105154.json" --format clipto -$EXECUTABLE "$CACHE/day_one/Day.One.zip" --format day_one -$EXECUTABLE "$CACHE/dynalist/dynalist-backup-2024-04-12.zip" --format dynalist -$EXECUTABLE "$CACHE/google_keep/takeout-20240401T160516Z-001.zip" --format google_keep -$EXECUTABLE "$CACHE/google_keep/takeout-20240401T160556Z-001.tgz" --format google_keep -$EXECUTABLE "$CACHE/joplin/29_04_2024.jex" --format joplin -$EXECUTABLE "$CACHE/jrnl/myjournal.json" --format jrnl -$EXECUTABLE "$CACHE/nimbus_note/Food" --format nimbus_note -$EXECUTABLE "$CACHE/notion/7acd77c1-0197-44e3-9793-ae81ab520ac9_Export-badce82a-60e8-402e-a32d-b0d89dc601cb.zip" --format notion -$EXECUTABLE "$CACHE/obsidian/obsidian_vault" --format obsidian -$EXECUTABLE "$CACHE/qownnotes/qownnotes_folder" --format qownnotes -$EXECUTABLE "$CACHE/rednotebook/data" --format rednotebook -$EXECUTABLE "$CACHE/rednotebook/RedNotebook-Backup-2024-09-15.zip" --format rednotebook -$EXECUTABLE "$CACHE/simplenote/notes.zip" --format simplenote -$EXECUTABLE "$CACHE/standard_notes/Standard Notes Backup - Sun Apr 28 2024 12_56_55 GMT+0200.zip" --format standard_notes -$EXECUTABLE "$CACHE/synology_note_station/notestation-test-books.nsx" --format synology_note_station -$EXECUTABLE "$CACHE/synology_note_station/test.nsx" --format synology_note_station -$EXECUTABLE "$CACHE/textbundle/Textbundle Example v1.textbundle/" --format textbundle -$EXECUTABLE "$CACHE/textbundle/Textbundle Example v2.textbundle/" --format textbundle -$EXECUTABLE "$CACHE/textbundle/example.textpack" --format textbundle -$EXECUTABLE "$CACHE/tiddlywiki/tiddlyhost.json" --format tiddlywiki -# $EXECUTABLE "$CACHE/todo_txt/examples_from_readme.txt" --format todo_txt -# $EXECUTABLE "$CACHE/todoist/Privates.csv" --format todoist -$EXECUTABLE "$CACHE/tomboy_ng/gnote/" --format tomboy_ng -$EXECUTABLE "$CACHE/tomboy_ng/tomboy-ng/" --format tomboy_ng -# $EXECUTABLE "$CACHE/toodledo/toodledo_completed_240427.csv" --format toodledo -# $EXECUTABLE "$CACHE/toodledo/toodledo_current_240427.csv" --format toodledo -# $EXECUTABLE "$CACHE/toodledo/toodledo_notebook_240427.csv" --format toodledo -# $EXECUTABLE "$CACHE/xit/example.xit" --format xit -# $EXECUTABLE "$CACHE/xit/example2.xit" --format xit -$EXECUTABLE "$CACHE/zim_md" -$EXECUTABLE "$CACHE/zoho_notebook/Notebook_14Apr2024_1300_html.zip" --format zoho_notebook - -popd diff --git a/test/manual_test.py b/test/manual_test.py new file mode 100644 index 00000000..3aa24189 --- /dev/null +++ b/test/manual_test.py @@ -0,0 +1,59 @@ +"""Cross platform script to run some manual tests.""" + +from pathlib import Path +import subprocess +import sys + + +def main(): + app_cmd = ["python", "../src/jimmy_cli.py"] + + cache = Path("../.cache") + # ruff: noqa: E501 + # fmt: off + input_arguments = [ + [cache / "arbitrary_folder"], + [cache / "arbitrary_folder", cache / "arbitrary_folder"], + [cache / "bear/backup.bear2bk", "--format", "bear"], + [cache / "cacher/cacher-export-202406182304.json", "--format" ,"cacher"], + [cache / "cherrytree/cherry.ctb.ctd", "--format" ,"cherrytree"], + [cache / "clipto/clipto_backup_240401_105154.json", "--format" ,"clipto"], + [cache / "day_one/Day.One.zip", "--format" ,"day_one"], + [cache / "dynalist/dynalist-backup-2024-04-12.zip", "--format" ,"dynalist"], + [cache / "google_keep/takeout-20240401T160516Z-001.zip", "--format" ,"google_keep"], + [cache / "google_keep/takeout-20240401T160556Z-001.tgz", "--format" ,"google_keep"], + [cache / "joplin/29_04_2024.jex", "--format" ,"joplin"], + [cache / "jrnl/myjournal.json", "--format" ,"jrnl"], + [cache / "nimbus_note/Food", "--format" ,"nimbus_note"], + [cache / "notion/7acd77c1-0197-44e3-9793-ae81ab520ac9_Export-badce82a-60e8-402e-a32d-b0d89dc601cb.zip", "--format" ,"notion"], + [cache / "obsidian/obsidian_vault", "--format" ,"obsidian"], + [cache / "qownnotes/qownnotes_folder", "--format" ,"qownnotes"], + [cache / "rednotebook/data", "--format" ,"rednotebook"], + [cache / "rednotebook/RedNotebook-Backup-2024-09-15.zip", "--format" ,"rednotebook"], + [cache / "simplenote/notes.zip", "--format" ,"simplenote"], + [cache / "standard_notes/Standard Notes Backup - Sun Apr 28 2024 12_56_55 GMT+0200.zip", "--format" ,"standard_notes"], + [cache / "synology_note_station/notestation-test-books.nsx", "--format" ,"synology_note_station"], + [cache / "synology_note_station/test.nsx", "--format" ,"synology_note_station"], + [cache / "textbundle/Textbundle Example v1.textbundle/", "--format" ,"textbundle"], + [cache / "textbundle/Textbundle Example v2.textbundle/", "--format" ,"textbundle"], + [cache / "textbundle/example.textpack", "--format" ,"textbundle"], + [cache / "tiddlywiki/tiddlyhost.json", "--format" ,"tiddlywiki"], + [cache / "tomboy_ng/gnote/", "--format" ,"tomboy_ng"], + [cache / "tomboy_ng/tomboy-ng/", "--format" ,"tomboy_ng"], + [cache / "zim_md"], + [cache / "zoho_notebook/Notebook_14Apr2024_1300_html.zip", "--format" ,"zoho_notebook"], + ] + # fmt:on + output_folder = Path("tmp_output") + output_folder.mkdir(exist_ok=True) + for arguments in input_arguments: + subprocess.run( + app_cmd + [str(arg) for arg in arguments], + stderr=sys.stderr, + stdout=sys.stdout, + cwd=output_folder, + ) + + +if __name__ == "__main__": + main()