| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Removed ``pytz`` as a dependency | ||
| -------------------------------- | ||
|
|
||
| Since ``dateutil`` and ``pytz`` both provide time zones, and matplotlib already depends on ``dateutil``, matplotlib will now use ``dateutil`` time zones internally and drop the redundant dependency on ``pytz``. While ``dateutil`` time zones are preferred (and currently recommended in the Python documentation), the explicit use of ``pytz`` zones is still supported. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -2,17 +2,25 @@ | |
| import tempfile | ||
| from unittest.mock import Mock | ||
|
|
||
| import dateutil | ||
| import dateutil.tz | ||
| import dateutil.rrule | ||
| import numpy as np | ||
| import pytest | ||
| import pytz | ||
|
|
||
| from matplotlib.testing.decorators import image_comparison | ||
| import matplotlib.pyplot as plt | ||
| from matplotlib.cbook import MatplotlibDeprecationWarning | ||
| import matplotlib.dates as mdates | ||
|
|
||
|
|
||
| def __has_pytz(): | ||
| try: | ||
| import pytz | ||
| return True | ||
| except ImportError: | ||
| return False | ||
|
Comment thread
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityHm, disturbing that this line isn't being hit. Something is indirectly pulling in a pytz dependency in the main test suite.
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI think the problem is pandas. I was under the impression that the pandas integration tests were being run separately from the main test suite. If that's no longer the case, then this is a bit of a problem, since you could have implicit dependencies on any of the pandas dependencies.
Sorry, something went wrong.
All reactions
|
||
|
|
||
|
|
||
| def test_date_numpyx(): | ||
| # test that numpy dates work properly... | ||
| base = datetime.datetime(2017, 1, 1) | ||
| Expand Down Expand Up | @@ -180,8 +188,8 @@ def test_RRuleLocator(): | |
|
|
||
| def test_RRuleLocator_dayrange(): | ||
| loc = mdates.DayLocator() | ||
| x1 = datetime.datetime(year=1, month=1, day=1, tzinfo=pytz.UTC) | ||
| y1 = datetime.datetime(year=1, month=1, day=16, tzinfo=pytz.UTC) | ||
| x1 = datetime.datetime(year=1, month=1, day=1, tzinfo=mdates.UTC) | ||
| y1 = datetime.datetime(year=1, month=1, day=16, tzinfo=mdates.UTC) | ||
| loc.tick_values(x1, y1) | ||
| # On success, no overflow error shall be thrown | ||
|
|
||
| Expand Down Expand Up | @@ -482,8 +490,8 @@ def test_date_inverted_limit(): | |
|
|
||
| def _test_date2num_dst(date_range, tz_convert): | ||
| # Timezones | ||
| BRUSSELS = pytz.timezone('Europe/Brussels') | ||
| UTC = pytz.UTC | ||
| BRUSSELS = dateutil.tz.gettz('Europe/Brussels') | ||
| UTC = mdates.UTC | ||
|
|
||
| # Create a list of timezone-aware datetime objects in UTC | ||
| # Interval is 0b0.0000011 days, to prevent float rounding issues | ||
| Expand Down Expand Up | @@ -575,10 +583,7 @@ def tz_convert(*args): | |
| _test_date2num_dst(pd.date_range, tz_convert) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("attach_tz, get_tz", [ | ||
| (lambda dt, zi: zi.localize(dt), lambda n: pytz.timezone(n)), | ||
| (lambda dt, zi: dt.replace(tzinfo=zi), lambda n: dateutil.tz.gettz(n))]) | ||
| def test_rrulewrapper(attach_tz, get_tz): | ||
| def _test_rrulewrapper(attach_tz, get_tz): | ||
| SYD = get_tz('Australia/Sydney') | ||
|
|
||
| dtstart = attach_tz(datetime.datetime(2017, 4, 1, 0), SYD) | ||
| Expand All | @@ -593,6 +598,25 @@ def test_rrulewrapper(attach_tz, get_tz): | |
| assert act == exp | ||
|
|
||
|
|
||
| def test_rrulewrapper(): | ||
| def attach_tz(dt, zi): | ||
| return dt.replace(tzinfo=zi) | ||
|
|
||
| _test_rrulewrapper(attach_tz, dateutil.tz.gettz) | ||
|
|
||
|
|
||
| @pytest.mark.pytz | ||
|
Comment thread
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityWhat's this mark?
Sorry, something went wrong.
All reactions
Copy link
Copy Markdown
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityAll otherwise unspecified marks are used to register a test with the mark of that name. This indicates that the decorated test uses pytz, so that you can filter out tests that require pytz (or that don't require pytz).
Sorry, something went wrong.
All reactions
|
||
| @pytest.mark.skipif(not __has_pytz(), reason="Requires pytz") | ||
| def test_rrulewrapper_pytz(): | ||
| # Test to make sure pytz zones are supported in rrules | ||
| import pytz | ||
|
|
||
| def attach_tz(dt, zi): | ||
| return zi.localize(dt) | ||
|
|
||
| _test_rrulewrapper(attach_tz, pytz.timezone) | ||
|
|
||
|
|
||
| def test_DayLocator(): | ||
| with pytest.raises(ValueError): | ||
| mdates.DayLocator(interval=-1) | ||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -15,5 +15,5 @@ pytest-rerunfailures | |
| pytest-timeout | ||
| pytest-xdist | ||
| python-dateutil | ||
| sphinx | ||
| tornado | ||
| tox | ||
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualitydouble underscore seems a bit overkill
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI have no strong preference here. I think I used double underscore because I intended it to be ephemeral. I think maybe I should switch it to:
We can drop the del line and switch to a single underscore if that's preferred style.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.