|
|
95774b8 |
From 1af9fdd2124547099eb0cf5a71b513ef5592dbf9 Mon Sep 17 00:00:00 2001
|
|
|
95774b8 |
From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= <fzatlouk@redhat.com>
|
|
|
95774b8 |
Date: Tue, 10 Aug 2021 00:00:50 +0200
|
|
|
95774b8 |
Subject: [PATCH] Tests: Use native TemporaryDirectory
|
|
|
95774b8 |
|
|
|
95774b8 |
Without ugly wrapper for Py < 3.2 that doesn't work half of the times...
|
|
|
95774b8 |
---
|
|
|
95774b8 |
js/src/jit-test/jit_test.py | 2 +-
|
|
|
95774b8 |
js/src/tests/jstests.py | 2 +-
|
|
|
95774b8 |
js/src/tests/lib/tempfile.py | 17 +----------------
|
|
|
95774b8 |
3 files changed, 3 insertions(+), 18 deletions(-)
|
|
|
95774b8 |
|
|
|
95774b8 |
diff --git a/js/src/jit-test/jit_test.py b/js/src/jit-test/jit_test.py
|
|
|
95774b8 |
index f5d7794..8d443aa 100755
|
|
|
95774b8 |
--- a/js/src/jit-test/jit_test.py
|
|
|
95774b8 |
+++ b/js/src/jit-test/jit_test.py
|
|
|
95774b8 |
@@ -38,7 +38,7 @@ from lib.tests import (
|
|
|
95774b8 |
get_environment_overlay,
|
|
|
95774b8 |
change_env,
|
|
|
95774b8 |
)
|
|
|
95774b8 |
-from lib.tempfile import TemporaryDirectory
|
|
|
95774b8 |
+from tempfile import TemporaryDirectory
|
|
|
95774b8 |
|
|
|
95774b8 |
|
|
|
95774b8 |
def which(name):
|
|
|
95774b8 |
diff --git a/js/src/tests/jstests.py b/js/src/tests/jstests.py
|
|
|
95774b8 |
index 6fa2f5f..53ceff6 100755
|
|
|
95774b8 |
--- a/js/src/tests/jstests.py
|
|
|
95774b8 |
+++ b/js/src/tests/jstests.py
|
|
|
95774b8 |
@@ -37,7 +37,7 @@ from lib.tests import (
|
|
|
95774b8 |
from lib.results import ResultsSink, TestOutput
|
|
|
95774b8 |
from lib.progressbar import ProgressBar
|
|
|
95774b8 |
from lib.adaptor import xdr_annotate
|
|
|
95774b8 |
-from lib.tempfile import TemporaryDirectory
|
|
|
95774b8 |
+from tempfile import TemporaryDirectory
|
|
|
95774b8 |
|
|
|
95774b8 |
if sys.platform.startswith("linux") or sys.platform.startswith("darwin"):
|
|
|
95774b8 |
from lib.tasks_unix import run_all_tests
|
|
|
95774b8 |
diff --git a/js/src/tests/lib/tempfile.py b/js/src/tests/lib/tempfile.py
|
|
|
95774b8 |
index ecc21c9..f0a1fa3 100644
|
|
|
95774b8 |
--- a/js/src/tests/lib/tempfile.py
|
|
|
95774b8 |
+++ b/js/src/tests/lib/tempfile.py
|
|
|
95774b8 |
@@ -2,19 +2,4 @@
|
|
|
95774b8 |
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
95774b8 |
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
95774b8 |
from __future__ import absolute_import
|
|
|
95774b8 |
-
|
|
|
95774b8 |
-try:
|
|
|
95774b8 |
- # Python 3.2
|
|
|
95774b8 |
- from tempfile import TemporaryDirectory
|
|
|
95774b8 |
-except ImportError:
|
|
|
95774b8 |
- import tempfile
|
|
|
95774b8 |
- import shutil
|
|
|
95774b8 |
- from contextlib import contextmanager
|
|
|
95774b8 |
-
|
|
|
95774b8 |
- @contextmanager
|
|
|
95774b8 |
- def TemporaryDirectory(*args, **kwds):
|
|
|
95774b8 |
- d = tempfile.mkdtemp(*args, **kwds)
|
|
|
95774b8 |
- try:
|
|
|
95774b8 |
- yield d
|
|
|
95774b8 |
- finally:
|
|
|
95774b8 |
- shutil.rmtree(d)
|
|
|
95774b8 |
+from tempfile import TemporaryDirectory
|
|
|
95774b8 |
--
|
|
|
95774b8 |
2.31.1
|
|
|
95774b8 |
|