home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 823260631

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/5191#issuecomment-823260631 https://api.github.com/repos/pydata/xarray/issues/5191 823260631 MDEyOklzc3VlQ29tbWVudDgyMzI2MDYzMQ== 14808389 2021-04-20T13:09:30Z 2021-04-20T13:35:29Z MEMBER

this seems to be something in pytest.raises: python with pytest.raises(error) as excinfo: ... behaves different from python with pytest.raises(error): ... so the test will pass for the former but not the latter.

Actually, I can reproduce without involving open_dataset (or xarray) at all: replacing it with calls to open_ will still close and show the exact same behavior. For reference, this will fail on the second assert: ```python import pytest import scipy.io

def open_(f): return scipy.io.netcdf_file(f, mode="r", version=2)

def test_open(): filename = "file.nc" with open(filename, mode="w") as f: f.write("abcdefghijklmnopqrstuvwxyz")

with open(filename, mode="rb") as f:
    with pytest.raises(TypeError) as excinfo:
        open_(f)
    assert not f.closed, "first file closed"

with open(filename, mode="rb") as f:
    with pytest.raises(TypeError):
        open_(f)
    assert not f.closed, "second file closed"

```

Edit: I tried asking the scipy devs, see scipy/scipy#13905

{
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  862107086
Powered by Datasette · Queries took 2.024ms · About: xarray-datasette