New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #2653 - Make DATE_PATH follow rrule #2656
Conversation
I don't know why Travis fails only in Python 3.5. Although Codacy fails, that part of the code was in the original. Should I fix it? |
You can ignore the travis failure, it looks like a random fluke / test-related problem which has nothing to do with your changes. Regarding the codacy issue: no, it wasn't there before your commit; before, it was calling |
Your changes don't work for me:
If I undo the change, I get:
(as expected) |
Printing You should modify |
Done. Thanks @felixfontein for your comments. |
The failing tests are completely unrelated to this PR. @Kwpolska: it looks like the baseline is out of date (a pygments update or so?). Also, there's a problem with Codacy coverage reporting:
|
How about replacing the tests in # NOW does not match rule #########################################
# No last date
expected = TODAY.replace(day=23)
self.assertEqual((expected, expected.strftime(FMT)), get_date(True, RULE_FR, tz=UTC))
self.assertEqual((expected, expected.strftime(FMT)), get_date(True, RULE_FR, tz=UTC))
# Last date in the past; doesn't match rule
date = TODAY.replace(hour=7)
expected = TODAY.replace(day=23, hour=7)
self.assertEqual((expected, expected.strftime(FMT)), get_date(True, RULE_FR, date, tz=UTC))
# Last date in the future; doesn't match rule
date = TODAY.replace(day=24, hour=7)
expected = TODAY.replace(day=30, hour=7)
self.assertEqual((expected, expected.strftime(FMT)), get_date(True, RULE_FR, date, tz=UTC))
# Last date in the past; matches rule
date = TODAY.replace(day=16, hour=8)
expected = TODAY.replace(day=23, hour=8)
self.assertEqual((expected, expected.strftime(FMT)), get_date(True, RULE_FR, date, tz=UTC))
# Last date in the future; matches rule
date = TODAY.replace(day=23, hour=18)
expected = TODAY.replace(day=30, hour=18)
self.assertEqual((expected, expected.strftime(FMT)), get_date(True, RULE_FR, date, tz=UTC))
# NOW matches rule ################################################
# Not scheduling should return NOW
self.assertEqual((NOW, _NOW), get_date(False, RULE_TH, tz=UTC))
# No last date
self.assertEqual((NOW, _NOW), get_date(True, RULE_TH, tz=UTC))
self.assertEqual((NOW, _NOW), get_date(True, RULE_TH, tz=UTC))
# Last date in the past; doesn't match rule
# Corresponding time has already passed, today
date = TODAY.replace(day=21, hour=7)
expected = TODAY.replace(day=29, hour=7)
self.assertEqual((expected, expected.strftime(FMT)), get_date(True, RULE_TH, date, tz=UTC))
# Corresponding time has not passed today
date = TODAY.replace(day=21, hour=18)
expected = TODAY.replace(day=22, hour=18)
self.assertEqual((expected, expected.strftime(FMT)), get_date(True, RULE_TH, date, tz=UTC))
# Last date in the future; doesn't match rule
# Corresponding time has already passed, today
date = TODAY.replace(day=24, hour=7)
expected = TODAY.replace(day=29, hour=7)
self.assertEqual((expected, expected.strftime(FMT)), get_date(True, RULE_TH, date, tz=UTC))
# Corresponding time has not passed today
date = TODAY.replace(day=24, hour=18)
expected = TODAY.replace(day=29, hour=18)
self.assertEqual((expected, expected.strftime(FMT)), get_date(True, RULE_TH, date, tz=UTC))
# Last date in the past; matches rule
# Corresponding time has already passed, today
date = TODAY.replace(day=15, hour=7)
expected = TODAY.replace(day=29, hour=7)
self.assertEqual((expected, expected.strftime(FMT)), get_date(True, RULE_TH, date, tz=UTC))
# Corresponding time has already passed, today; rule specifies HOUR
date = TODAY.replace(day=15, hour=7)
expected = TODAY.replace(day=29, hour=9)
self.assertEqual((expected, expected.strftime(FMT)), get_date(True, RULE_TH + ';BYHOUR=9', date, tz=UTC))
# Corresponding time has not passed today
date = TODAY.replace(day=15, hour=18)
expected = TODAY.replace(day=22, hour=18)
self.assertEqual((expected, expected.strftime(FMT)), get_date(True, RULE_TH, date, tz=UTC))
# Last date in the future; matches rule
# Corresponding time has already passed, today
date = TODAY.replace(day=29, hour=7)
expected = TODAY.replace(day=5, month=9, hour=7)
self.assertEqual((expected, expected.strftime(FMT)), get_date(True, RULE_TH, date, tz=UTC))
# Corresponding time has not passed today
date = TODAY.replace(day=22, hour=18)
expected = TODAY.replace(day=29, hour=18)
self.assertEqual((expected, expected.strftime(FMT)), get_date(True, RULE_TH, date, tz=UTC)) |
In the code I posted above, replace The |
Also, you can add yourself to |
Ah. Already there, then :) |
OK, I've screwed things up in a completely stupid way. Let me fix this. I'm really sorry for the trouble. |
No problem! Take your time. |
OK, this is done at last. I'm sorry again for the trouble. By the way, there are two tests in |
@felixfontein: Actually, if I understood the code correctly, the replacements are in fact necessary, as |
But it isn't using Which Python version under which operating system do you have which returns |
I think I saw Travis itself returning +00:00 in the failing tests.
That's why I replaced it in the first place.
|
Well, so far it worked fine without the replace, both on travis and on my local machine (and on other machines as well). So it should be unnecessary. @Kwpolska: what do you think? Are these replacements OK? |
These don’t match because two different methods are in use. |
Now that I think about it, the replacements weren't necessary in the first tests update (I rebased too much and that diff is gone now, sorry). |
Just change those tests to look only at the datetime object. |
Done.
|
Travis tests fail because you are not a member of the @getnikola organization, and thus Travis prevents your PR from accessing the token (which is pretty smart from the security perspective). I fixed that on master for future PRs, and I’m merging yours. Thank you for contributing to Nikola! 🎉 |
Thank you for your patience (my coding skills are somewhat poor).
|
No description provided.