aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2024-10-31 21:23:28 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2024-10-31 21:44:26 +0100
commit8544bbd302297ebb016447d637cb6d1b4bf2d0fb (patch)
tree5bedb20f47f9fed6e213192b43a73203a211c109
parent517fa0965cc6d83228cfaa4227bad97415e303cb (diff)
downloadgeldschieberbot-8544bbd302297ebb016447d637cb6d1b4bf2d0fb.tar.gz
geldschieberbot-8544bbd302297ebb016447d637cb6d1b4bf2d0fb.zip
skip test_montly if current day is not present in previous months
-rwxr-xr-xtest.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/test.py b/test.py
index 8535485..602be6d 100755
--- a/test.py
+++ b/test.py
@@ -1309,7 +1309,13 @@ Cancelled the monthly cmd "stuff\""""
# Last exec one month ago
if now.month > 1:
- one_month_ago = date(now.year, now.month - 1, now.day)
+ one_month_ago = None
+ try:
+ one_month_ago = date(now.year, now.month - 1, now.day)
+ except ValueError:
+ self.skipTest(
+ f"current day {now.day} does not exist in previous month")
+
else:
one_month_ago = date(now.year - 1, 12, now.day)
reset_state_string(
@@ -1335,7 +1341,11 @@ alice:
# Last exec two month ago
if now.month > 2:
- two_months_ago = date(now.year, now.month - 2, now.day)
+ try:
+ two_months_ago = date(now.year, now.month - 2, now.day)
+ except ValueError:
+ self.skipTest(
+ f"current day {now.day} does not exist two months ago")
else:
two_months_ago = date(now.year - 1, 12 - now.month + 1, now.day)