Clean up compatibility code in importlib fixtures (#19156)
This commit is contained in:
parent
5eca75df03
commit
574547a75c
|
@ -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