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 os
|
||||||
import sys
|
import sys
|
||||||
import shutil
|
import shutil
|
||||||
|
import pathlib
|
||||||
import tempfile
|
import tempfile
|
||||||
import textwrap
|
import textwrap
|
||||||
import contextlib
|
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
|
@contextlib.contextmanager
|
||||||
def tempdir():
|
def tempdir():
|
||||||
|
@ -58,7 +44,7 @@ def install_finder(finder):
|
||||||
|
|
||||||
class Fixtures:
|
class Fixtures:
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.fixtures = ExitStack()
|
self.fixtures = contextlib.ExitStack()
|
||||||
self.addCleanup(self.fixtures.close)
|
self.addCleanup(self.fixtures.close)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue