html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/pull/4600#issuecomment-734759599,https://api.github.com/repos/pydata/xarray/issues/4600,734759599,MDEyOklzc3VlQ29tbWVudDczNDc1OTU5OQ==,10194086,2020-11-27T10:17:32Z,2020-11-27T10:17:32Z,MEMBER,"Ok. let's get this in before the release. Thanks again @Nirupamkn @yashsaboo, happy to have you as contributors!","{""total_count"": 3, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 2, ""rocket"": 0, ""eyes"": 0}",,748379763
https://github.com/pydata/xarray/pull/4600#issuecomment-734394984,https://api.github.com/repos/pydata/xarray/issues/4600,734394984,MDEyOklzc3VlQ29tbWVudDczNDM5NDk4NA==,5635139,2020-11-26T16:33:44Z,2020-11-26T16:33:44Z,MEMBER,"Yes exactly, under ""Internal Changes""","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,748379763
https://github.com/pydata/xarray/pull/4600#issuecomment-734087493,https://api.github.com/repos/pydata/xarray/issues/4600,734087493,MDEyOklzc3VlQ29tbWVudDczNDA4NzQ5Mw==,5635139,2020-11-26T05:43:20Z,2020-11-26T05:43:20Z,MEMBER,@Nirupamkn @yashsaboo do you want to add an entry to the whatsnew file?,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,748379763
https://github.com/pydata/xarray/pull/4600#issuecomment-733990530,https://api.github.com/repos/pydata/xarray/issues/4600,733990530,MDEyOklzc3VlQ29tbWVudDczMzk5MDUzMA==,5635139,2020-11-25T23:31:25Z,2020-11-25T23:31:25Z,MEMBER,Thanks @yashsaboo ! Great to have you as a contributor!,"{""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,748379763
https://github.com/pydata/xarray/pull/4600#issuecomment-733235217,https://api.github.com/repos/pydata/xarray/issues/4600,733235217,MDEyOklzc3VlQ29tbWVudDczMzIzNTIxNw==,10194086,2020-11-24T21:10:16Z,2020-11-24T21:10:16Z,MEMBER,"Good catch! If you haven't lost patience, there are two more things that leave open figures: `test_plot_transposed_nondim_coord` and some of the tests in `TestDiscreteColorMap`.
1. To fix the first both of these lines need to be enclosed in a `figure_context` (each line separately):
https://github.com/pydata/xarray/blob/f1e2f9d510a63480f4dd7917083cd982ac4d451d/xarray/tests/test_plot.py#L2431-L2432
2. To fix the second you can add the following code
```python
yield
# Remove all matplotlib figures
plt.close(""all"")
```
_after_ the following line:
https://github.com/pydata/xarray/blob/f1e2f9d510a63480f4dd7917083cd982ac4d451d/xarray/tests/test_plot.py#L964
And you should give yourselves credit in what's new. That's now more than a one-liner ;-)
---
Just as an addendum. The figures in the `PlotTestCase` class are autoclosed by
https://github.com/pydata/xarray/blob/f1e2f9d510a63480f4dd7917083cd982ac4d451d/xarray/tests/test_plot.py#L128-L133
but only if no more than one figure is opened per method.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,748379763
https://github.com/pydata/xarray/pull/4600#issuecomment-733216560,https://api.github.com/repos/pydata/xarray/issues/4600,733216560,MDEyOklzc3VlQ29tbWVudDczMzIxNjU2MA==,14808389,2020-11-24T20:30:00Z,2020-11-24T20:30:00Z,MEMBER,"how thorough should this be? If I understand it correctly, there are still a few calls left, e.g. in `test_plot_transposed_nondim_coord` (hidden by `getattr` calls).","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,748379763
https://github.com/pydata/xarray/pull/4600#issuecomment-732445905,https://api.github.com/repos/pydata/xarray/issues/4600,732445905,MDEyOklzc3VlQ29tbWVudDczMjQ0NTkwNQ==,10194086,2020-11-23T21:48:28Z,2020-11-23T21:48:28Z,MEMBER,"Thanks! There are two more instances that would be good to wrap in a `figure_context`.
https://github.com/pydata/xarray/blob/a28f0df559cf5a18fce6c4a78277d3ef60898c0f/xarray/tests/test_plot.py#L316
https://github.com/pydata/xarray/blob/a28f0df559cf5a18fce6c4a78277d3ef60898c0f/xarray/tests/test_plot.py#L1759
If you want you can also give yourselves credit in [whats-new](https://github.com/pydata/xarray/blob/master/doc/whats-new.rst).","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,748379763
https://github.com/pydata/xarray/pull/4600#issuecomment-732041825,https://api.github.com/repos/pydata/xarray/issues/4600,732041825,MDEyOklzc3VlQ29tbWVudDczMjA0MTgyNQ==,10194086,2020-11-23T09:36:25Z,2020-11-23T09:36:25Z,MEMBER,"Thanks for looking into this. Yes, closing the figure at the beginning is brittle, unless _every_ test does it. However, it cannot be done at the end because else the figure is not closed if there is an error in the test (and the figure is still open at the start of the next test).
My preference is to enclose the test in a `figure_context` as already done for some of the tests:
https://github.com/pydata/xarray/blob/9533c92c675a30b8c9803da8d5c9bc529763f3eb/xarray/tests/test_plot.py#L2456-L2457
`figure_context` is a small context manager that wraps a `try: ... finally` block, closing all open figures.
https://github.com/pydata/xarray/blob/9533c92c675a30b8c9803da8d5c9bc529763f3eb/xarray/tests/test_plot.py#L49
I think all `plt.clf()` instances should be replaced with `figure_context`. I missed those in my PR (#4365). Let us know if you are up to that.
cc @dcherian","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,748379763