[Numpy-svn] [numpy/numpy] 443184: ENH: Add context manager `temppath` to manage a te...

GitHub noreply at github.com
Sun Dec 20 12:47:45 EST 2015


  Branch: refs/heads/master
  Home:   https://github.com/numpy/numpy
  Commit: 443184b12513ce2a8adcc2a81c143bc4bc697219
      https://github.com/numpy/numpy/commit/443184b12513ce2a8adcc2a81c143bc4bc697219
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2015-12-19 (Sat, 19 Dec 2015)

  Changed paths:
    M numpy/testing/tests/test_utils.py
    M numpy/testing/utils.py

  Log Message:
  -----------
  ENH: Add context manager `temppath` to manage a temporary file.

Context manager intended for use when the same temporary file needs to
be opened and closed more than once. The context manager creates the
file, closes it, and returns the path to the file. On exit from the
context block the file is removed. The file should be closed before
exiting the context as an error will be raised on windows if not.

Also fix up the `tempdir` context manager to deal with exceptions.

Tests are added for both `temppath` and `tempdir`.


  Commit: c4156cfbe9c22ab99473346b7757d2b54b46baa3
      https://github.com/numpy/numpy/commit/c4156cfbe9c22ab99473346b7757d2b54b46baa3
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2015-12-20 (Sun, 20 Dec 2015)

  Changed paths:
    M numpy/lib/tests/test_io.py
    M numpy/testing/tests/test_utils.py

  Log Message:
  -----------
  MAINT: Use temppath in test_not_closing_opened_fid.

The test is in numpy/lib/tests/test_io.py. This commit is intended
as a demonstration of using temppath.


  Commit: 765422cfa5a959985808bbf11f7a6a58a9dc5e46
      https://github.com/numpy/numpy/commit/765422cfa5a959985808bbf11f7a6a58a9dc5e46
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2015-12-20 (Sun, 20 Dec 2015)

  Changed paths:
    M numpy/lib/tests/test_io.py
    M numpy/testing/tests/test_utils.py
    M numpy/testing/utils.py

  Log Message:
  -----------
  Merge pull request #6866 from charris/tempfile-context-manager

ENH: Tempfile context manager


Compare: https://github.com/numpy/numpy/compare/f125b7d45671...765422cfa5a9


More information about the Numpy-svn mailing list