XZise has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176501

Change subject: [FIX] Tests: Skip timestamp tests if month changes
......................................................................

[FIX] Tests: Skip timestamp tests if month changes

On the last and first day of a month, simply adding a day or subtracting
a day will cause the day to go out of bounds. So if the month changes,
it's probably the last or first day of a month and certain tests don't
work reliably without any advanced logic which would defy the test as it
would test itself.

Bug: T76285
Change-Id: Ibeb12f4f911c0bc9d40a92ca718464a90082f428
---
M tests/timestamp_tests.py
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/01/176501/1

diff --git a/tests/timestamp_tests.py b/tests/timestamp_tests.py
index c3e0c2b..015fa5c 100644
--- a/tests/timestamp_tests.py
+++ b/tests/timestamp_tests.py
@@ -55,6 +55,8 @@
     def test_add_timedelta(self):
         t1 = T.utcnow()
         t2 = t1 + datetime.timedelta(days=1)
+        if t1.month != t2.month:
+            raise unittest.SkipTest('Test does not work if month also 
changes.')
         self.assertEqual(t1.day + 1, t2.day)
         self.assertIsInstance(t2, T)
 
@@ -74,6 +76,8 @@
     def test_sub_timedelta(self):
         t1 = T.utcnow()
         t2 = t1 - datetime.timedelta(days=1)
+        if t1.month != t2.month:
+            raise unittest.SkipTest('Test does not work if month also 
changes.')
         self.assertEqual(t1.day - 1, t2.day)
         self.assertIsInstance(t2, T)
 

-- 
To view, visit https://gerrit.wikimedia.org/r/176501
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibeb12f4f911c0bc9d40a92ca718464a90082f428
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to