home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 732041825

This data as json

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-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
Powered by Datasette · Queries took 2.736ms · About: xarray-datasette