From 2ae9c38627aa18fdd116432cc9f761ac4dd7c01c Mon Sep 17 00:00:00 2001 From: furtest Date: Wed, 7 Jan 2026 23:35:26 +0100 Subject: [PATCH] tests : add some simple code to run a few tests --- tests/runners.py | 8 ++++++++ tests/test.py | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 tests/runners.py create mode 100644 tests/test.py diff --git a/tests/runners.py b/tests/runners.py new file mode 100644 index 0000000..11e162d --- /dev/null +++ b/tests/runners.py @@ -0,0 +1,8 @@ +# Copyright (C) 2026 Paul Retourné +# SPDX-License-Identifier: GPL-3.0-or-later + +from unisync.synchroniser import Synchroniser +from unisync.paths import PathsManager + +def unisync_test(synchroniser:Synchroniser, paths_manager:PathsManager): + print("Testing") diff --git a/tests/test.py b/tests/test.py new file mode 100644 index 0000000..6312859 --- /dev/null +++ b/tests/test.py @@ -0,0 +1,39 @@ +# Copyright (C) 2026 Paul Retourné +# SPDX-License-Identifier: GPL-3.0-or-later + +import os +from pathlib import Path + +from unisync.argparser import create_argparser +from unisync.runners import unisync_sync, unisync_add, unisync_mount +from unisync.config import load_config +from unisync.synchroniser import Synchroniser +from unisync.paths import * + +from runners import * + +def main(): + parser = create_argparser(unisync_test, unisync_add, unisync_mount) + cli_args = parser.parse_args() + + config_path = os.path.expanduser("./config.ini") + config = load_config(config_path) + + print(config) + + synchroniser = Synchroniser( + config.roots.remote, + config.roots.local, + config.server.user, + config.server.ip if config.server.ip != "" else config.server.hostname, + config.server.port, + config.unison.bools, + config.unison.values + ) + + paths_manager = PathsManager(Path(config.roots.local), config.other.cache_dir_path) + + cli_args.func(synchroniser, paths_manager) + +if __name__ == "__main__": + main()