Clean up compatibility code in importlib fixtures (GH-19156) (#19543)
(cherry picked from commit 574547a75c
)
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
This commit is contained in:
parent
7c82528d40
commit
5594c07d97
|
@ -1,25 +1,11 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import pathlib
|
||||
import tempfile
|
||||
import textwrap
|
||||
import contextlib
|
||||
|
||||
try:
|
||||
from contextlib import ExitStack
|
||||
except ImportError:
|
||||
from contextlib2 import ExitStack
|
||||
|
||||
try:
|
||||
import pathlib
|
||||
except ImportError:
|
||||
import pathlib2 as pathlib
|
||||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def tempdir():
|
||||
|
@ -58,7 +44,7 @@ def install_finder(finder):
|
|||
|
||||
class Fixtures:
|
||||
def setUp(self):
|
||||
self.fixtures = ExitStack()
|
||||
self.fixtures = contextlib.ExitStack()
|
||||
self.addCleanup(self.fixtures.close)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue