From 0fccb7f5b02367e1a91c6a46e2c71ee7835eb5dc Mon Sep 17 00:00:00 2001 From: Krishnasis Mandal Date: Sat, 16 Mar 2024 14:18:27 +0100 Subject: [PATCH] test: Add basic test --- tests/__init__.py | 0 tests/test_lib.py | 16 ++++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/test_lib.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_lib.py b/tests/test_lib.py new file mode 100644 index 0000000..270dc64 --- /dev/null +++ b/tests/test_lib.py @@ -0,0 +1,16 @@ +import time + +from retry_later import retry_later + + +@retry_later() +def write_to_file(file_name: str, body: str): + with open(file_name, "w") as f: + f.write(body) + + +def test_success_once(): + write_to_file("test.txt", "hello world") + time.sleep(5) + with open("test.txt") as f: + assert "hello world" in f.readlines()