Commit Graph

111 Commits

Author SHA1 Message Date
Serhiy Storchaka 5b10b98247
bpo-22831: Use "with" to avoid possible fd leaks in tests (part 2). (GH-10929) 2019-03-05 10:06:26 +02:00
Anthony Sottile 8377cd4fcd Clean up code which checked presence of os.{stat,lstat,chmod} (#11643) 2019-02-25 23:32:27 +01:00
sth 825aab95fd bpo-27300: Add the errors parameter to tempfile classes. (GH-6696) 2018-05-23 08:07:01 +03:00
Victor Stinner 6c8c2943d9 bpo-31160: test_tempfile: Fix reap_children() warning (#3056)
TestRandomNameSequence.test_process_awareness() now calls
os.waitpid() to avoid leaking a zombie process.
2017-08-10 13:05:06 +02:00
Serhiy Storchaka d1a1def7bf bpo-30197: Enhance functions swap_attr() and swap_item() in test.support. (#1341)
* bpo-30197: Enhance functions swap_attr() and swap_item() in test.support.

They now work when delete replaced attribute or item inside the with
statement.  The old value of the attribute or item (or None if it doesn't
exist) now will be assigned to the target of the "as" clause, if there is
one.

* Update docstrings.
2017-04-28 18:17:26 +02:00
Victor Stinner 1e62bf145b bpo-30030: Revert f50354ad (tempfile) (#1187)
Revert f50354adaaafebe95ad09d09b825804a686ea843: it introduced a
regression in test_threadedtempfile.
2017-04-19 22:59:51 +02:00
Serhiy Storchaka f50354adaa Reimplement tempfile._RandomNameSequence using a generator function. (#1075) 2017-04-11 22:45:59 +03:00
Martin Panter 7869a22779 Issue #26385: Cleanup NamedTemporaryFile if open() fails, by SilentGhost 2016-02-28 05:22:20 +00:00
Gregory P. Smith ad577b938b Issue 24230: The tempfile module now accepts bytes for prefix, suffix and dir
parameters and returns bytes in such situations (matching the os module APIs).
2015-05-22 16:18:14 -07:00
Serhiy Storchaka 492f027793 Issue #22107: tempfile.gettempdir() and tempfile.mkdtemp() now try again
when a directory with the chosen name already exists on Windows as well as
on Unix.  tempfile.mkstemp() now fails early if parent directory is not
valid (not exists or is a file) on Windows.
2015-05-20 00:14:00 +03:00
Serhiy Storchaka 5d6b7b1cb7 Issue #22107: tempfile.gettempdir() and tempfile.mkdtemp() now try again
when a directory with the chosen name already exists on Windows as well as
on Unix.  tempfile.mkstemp() now fails early if parent directory is not
valid (not exists or is a file) on Windows.
2015-05-20 00:11:48 +03:00
Berker Peksag ce643913a9 Issue #9517: Move script_helper to the support package.
Patch by Christie Wilson.
2015-05-06 06:33:17 +03:00
Zachary Ware 38c707e7e0 Issue #21741: Update 147 test modules to use test discovery.
I have compared output between pre- and post-patch runs of these tests
to make sure there's nothing missing and nothing broken, on both
Windows and Linux.  The only differences I found were actually tests
that were previously *not* run.
2015-04-13 15:00:43 -05:00
Serhiy Storchaka 56cefa69ee Issue #23700: Iterator of NamedTemporaryFile now keeps a reference to
NamedTemporaryFile instance.  Patch by Bohuslav Kabrda.
2015-03-19 15:23:15 +02:00
Serhiy Storchaka 5e193ac0bd Issue #22427: TemporaryDirectory no longer attempts to clean up twice when
used in the with statement in generator.
2014-09-24 13:26:25 +03:00
Victor Stinner c61c170b41 Issue #18174: Fix leak of file descriptor in test_tempfile 2014-07-29 01:13:39 +02:00
Victor Stinner 87d13ea56d Issue #21058: fix typo in a comment. Patch written by Vajrasky Kok. 2014-03-25 18:19:17 +01:00
Victor Stinner 1f99f9d5c2 Issue #21058: Fix a leak of file descriptor in tempfile.NamedTemporaryFile(),
close the file descriptor if io.open() fails
2014-03-25 09:18:04 +01:00
Serhiy Storchaka a28632be56 Issue #19077: tempfile.TemporaryDirectory cleanup no longer fails when
called during shutdown.  Emitting resource warning in __del__ no longer fails.
Original patch by Antoine Pitrou.
2014-01-27 11:21:54 +02:00
Serhiy Storchaka 99e033b02e Issue #19077: tempfile.TemporaryDirectory cleanup is now most likely
successful when called during nulling out of modules during shutdown.
Misleading exception no longer raised when resource warning is emitted
during shutdown.
2014-01-27 11:18:27 +02:00
Antoine Pitrou 2b7f69851d Issue #18879: When a method is looked up on a temporary file, avoid closing the file before the method is possibly called. 2013-12-21 22:16:19 +01:00
Antoine Pitrou 17c93260a6 Issue #18879: When a method is looked up on a temporary file, avoid closing the file before the method is possibly called. 2013-12-21 22:14:56 +01:00
Zachary Ware 101d9e7250 Issue 19572: More silently skipped tests explicitly skipped. 2013-12-08 00:44:27 -06:00
Zachary Ware 9fe6d86709 Issue 19572: More silently skipped tests explicitly skipped. 2013-12-08 00:20:35 -06:00
Tim Golden 6d09f09d8b Issue14255 Don't flatten case of tempdir 2013-10-25 18:38:16 +01:00
Eli Bendersky 7290608af7 Issue #18945: Add tests for tempfile name collision handling.
Patch by Vlad Shcherbina
2013-09-13 05:30:00 -07:00
Eli Bendersky aa04f9ae7d Issue #18945: Add tests for tempfile name collision handling.
Patch by Vlad Shcherbina
2013-09-13 05:28:20 -07:00
Eli Bendersky 309836c5c8 Issue #18849: Fixed a Windows-specific tempfile bug where collision with an
existing directory caused mkstemp and related APIs to fail instead of
retrying. Report and fix by Vlad Shcherbina.
2013-09-06 06:14:16 -07:00
Eli Bendersky f315df31bd Issue #18849: Fixed a Windows-specific tempfile bug where collision with an
existing directory caused mkstemp and related APIs to fail instead of
retrying. Report and fix by Vlad Shcherbina.
2013-09-06 06:11:19 -07:00
Victor Stinner daf455554b Issue #18571: Implementation of the PEP 446: file descriptors and file handles
are now created non-inheritable; add functions os.get/set_inheritable(),
os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
2013-08-28 00:53:59 +02:00
Victor Stinner 97869103ba Close #12015: The tempfile module now uses a suffix of 8 random characters
instead of 6, to reduce the risk of filename collision. The entropy was reduced
when uppercase letters were removed from the charset used to generate random
characters.
2013-08-14 01:28:28 +02:00
Serhiy Storchaka 94cd10fa19 Issue #16800: tempfile.gettempdir() no longer left temporary files when
the disk is full.  Original patch by Amir Szekely.
2013-02-13 00:38:48 +02:00
Serhiy Storchaka ff7fef9601 Issue #16800: tempfile.gettempdir() no longer left temporary files when
the disk is full.  Original patch by Amir Szekely.
2013-02-13 00:37:29 +02:00
Serhiy Storchaka f6b361ec1a Issue #16800: tempfile.gettempdir() no longer left temporary files when
the disk is full.  Original patch by Amir Szekely.
2013-02-13 00:35:30 +02:00
Serhiy Storchaka 34a2a87d17 Fix a test for SpooledTemporaryFile (added in issue #10355). 2013-02-10 14:44:43 +02:00
Serhiy Storchaka bf95c143a2 Fix a test for SpooledTemporaryFile (added in issue #10355). 2013-02-10 14:44:14 +02:00
Serhiy Storchaka 497cee456c Fix a test for SpooledTemporaryFile (added in issue #10355). 2013-02-10 14:43:46 +02:00
Serhiy Storchaka 26cab56542 Issue #17169: Restore errno in tempfile exceptions. 2013-02-09 22:27:23 +02:00
Serhiy Storchaka 7451a72e2b Issue #17169: Restore errno in tempfile exceptions. 2013-02-09 22:25:49 +02:00
Serhiy Storchaka 5d70ccc4a9 Issue #10355: SpooledTemporaryFile properties now work for unrolled files.
Remove obsoleted xreadline method.
2013-02-09 12:22:29 +02:00
Serhiy Storchaka 33182807f8 Issue #10355: SpooledTemporaryFile properties now work for unrolled files.
Remove obsoleted xreadline method.
2013-02-09 12:21:52 +02:00
Serhiy Storchaka bbbbe8eb60 Issue #10355: SpooledTemporaryFile properties now work for unrolled files.
Remove obsoleted xreadline method.
2013-02-09 12:21:14 +02:00
Andrew Svetlov ad28c7f9da Issue #16706: get rid of os.error 2012-12-18 22:02:39 +02:00
Andrew Svetlov 3438fa496d Get rig of EnvironmentError (#16705) 2012-12-17 23:35:18 +02:00
Jesus Cea 4791a24268 #16135: Removal of OS/2 support (Python code partial cleanup) 2012-10-05 03:15:39 +02:00
Antoine Pitrou eab2a50dfc PEP8-ize test names 2012-03-10 16:34:40 +01:00
Antoine Pitrou 8cd8d5e8f2 Remove useless failOnException() method 2012-03-10 16:20:24 +01:00
Antoine Pitrou c24847658f Issue #12856: Ensure child processes do not inherit the parent's random seed for filename generation in the tempfile module.
Patch by Brian Harring.
2011-11-25 21:29:27 +01:00
Antoine Pitrou 4558bad7d6 Issue #12856: Ensure child processes do not inherit the parent's random seed for filename generation in the tempfile module.
Patch by Brian Harring.
2011-11-25 21:28:15 +01:00
Antoine Pitrou 0e86a5842d Issue #9957: SpooledTemporaryFile.truncate() now accepts an optional size parameter, as other file-like objects.
Patch by Ryan Kelly.
2011-11-25 18:03:09 +01:00