Skip to content

TST: remove ResourceWarnings #12897

Closed
Closed
@jreback

Description

@jreback

So just enabled ResourceWarnings to show up (these are only on PY3), see a sample run here; they are only enabled on the 3.5-dev build (you can manually enable by setting PANDAS_TESTING_MODE="deprecate"

These are unclosed filehandles mostly in the read_csv tests.

So there are 2 cases here which need to be dealt with:

  • when we uncompress things, we create a wrapper around the decompressor, these need to be closed, ONLY if the original handle was a string (IOW a pth), and NOT a filehandle itself (which we need to leave open)
  • when we have a utf-16 encoding we create a UTFReader object which needs to be closed (but same as above, you can't close it if the original handle was open to begin with)

So I added some .close() methods to the readers, but they are not explicity called anywhere. We need to figure out when to do this.

This might be a bit non-trivial!

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO CSVread_csv, to_csvIO DataIO issues that don't fit into a more specific labelTestingpandas testing functions or related to the test suite

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions