diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2024-10-31 21:23:28 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2024-10-31 21:44:26 +0100 |
| commit | 8544bbd302297ebb016447d637cb6d1b4bf2d0fb (patch) | |
| tree | 5bedb20f47f9fed6e213192b43a73203a211c109 | |
| parent | 517fa0965cc6d83228cfaa4227bad97415e303cb (diff) | |
| download | geldschieberbot-8544bbd302297ebb016447d637cb6d1b4bf2d0fb.tar.gz geldschieberbot-8544bbd302297ebb016447d637cb6d1b4bf2d0fb.zip | |
skip test_montly if current day is not present in previous months
| -rwxr-xr-x | test.py | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -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) |
