Skip to content

Fix unexpected loading after print - #1724

Merged
shoyer merged 3 commits into
pydata:masterfrom
fujiisoup:backend_inmemory_check
Nov 17, 2017
Merged

shoyer merged 3 commits into
pydata:masterfrom
fujiisoup:backend_inmemory_check

Conversation

@fujiisoup

Copy link
Copy Markdown
Member

Only a single missing underscore causes this issue :)
Added tests.

@shoyer shoyer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! In the long term, it would be nice to get ride of these uses of _data, maybe by switching entirely from our lazy array classes to Dask.

Comment thread xarray/tests/test_backends.py Outdated
""" Make sure print does not load file into memory """
in_memory = create_test_data()
with self.roundtrip(in_memory) as on_disk:
if not on_disk['var1']._in_memory:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we write this without the conditional check? It's usually best to avoid control flow in tests -- it makes it more obvious what is going on.

Comment thread xarray/tests/test_backends.py Outdated
in_memory = create_test_data()
with self.roundtrip(in_memory) as on_disk:
if not on_disk['var1']._in_memory:
print(on_disk)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just call repr(on_disk) to avoid actually printing to stdout.

@fujiisoup

Copy link
Copy Markdown
Member Author

@shoyer
Thanks. Fixed.

In the long term, it would be nice to get ride of these uses of _data, maybe by switching entirely from our lazy array classes to Dask.

Maybe related to your previous comment in #1705?
It sounds great.
I will raise another issue (maybe better to wait for the work by @benbovy #1627).

@shoyer
shoyer merged commit 6463504 into pydata:master Nov 17, 2017
@shoyer shoyer mentioned this pull request Nov 20, 2017
13 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants