mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 14:32:28 +03:00
tests: use context manager and/or standard setup temp files
This commit is contained in:
parent
1eeb992118
commit
d29a486e31
12 changed files with 465 additions and 680 deletions
|
@ -17,6 +17,7 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
|
||||
class TmpCwd():
|
||||
|
@ -58,3 +59,10 @@ def mock_open_to_str(mock):
|
|||
return "".join([
|
||||
x.args[0] for x in mock.mock_calls if str(x).startswith("call().write(")
|
||||
])
|
||||
|
||||
|
||||
def mkdtemp():
|
||||
if sys.version_info < (3, 10): # ignore_cleanup_errors was added in 3.10
|
||||
return tempfile.TemporaryDirectory()
|
||||
else:
|
||||
return tempfile.TemporaryDirectory(ignore_cleanup_errors=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue