diff --git a/common/lib/xmodule/xmodule/modulestore/tests/utils.py b/common/lib/xmodule/xmodule/modulestore/tests/utils.py index 063e561c62..03dd6c83dd 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/utils.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/utils.py @@ -5,7 +5,8 @@ from __future__ import absolute_import import io import os -from contextlib import contextmanager, nested +from contextlib import contextmanager +from contextlib2 import ExitStack from importlib import import_module from shutil import rmtree from tempfile import mkdtemp @@ -255,7 +256,7 @@ class StoreBuilderBase(object): @contextmanager def build(self, **kwargs): """ - Build the modulstore, optionally building the contentstore as well. + Build the modulestore, optionally building the contentstore as well. """ contentstore = kwargs.pop('contentstore', None) if not contentstore: @@ -419,7 +420,8 @@ class MixedModulestoreBuilder(StoreBuilderBase): """ names, generators = list(zip(*self.store_builders)) - with nested(*(gen.build_with_contentstore(contentstore, **kwargs) for gen in generators)) as modulestores: + with ExitStack() as stack: + modulestores = [stack.enter_context(gen.build_with_contentstore(contentstore, **kwargs)) for gen in generators] # Make the modulestore creation function just return the already-created modulestores store_iterator = iter(modulestores) next_modulestore = lambda *args, **kwargs: next(store_iterator) diff --git a/requirements/edx/base.in b/requirements/edx/base.in index 8cdd7c7d82..f21e44b7fb 100644 --- a/requirements/edx/base.in +++ b/requirements/edx/base.in @@ -34,6 +34,7 @@ boto==2.39.0 # Deprecated version of the AWS SDK; we shou boto3==1.4.8 # Amazon Web Services SDK for Python botocore==1.8.17 # via boto3, s3transfer celery==3.1.25 # Asynchronous task execution library +contextlib2 # We need contextlib2.ExitStack so we can stop using contextlib.nested which doesn't exist in python 3 defusedxml Django<1.12 # Web application framework django-babel-underscore # underscore template extractor for django-babel (internationalization utilities) diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index 852acfe231..be9a3f6603 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -44,6 +44,7 @@ chardet==3.0.4 git+https://github.com/edx/openedx-chem.git@ff4e3a03d3c7610e47a9af08eb648d8aabe2eb18#egg=chem==1.0.0 click==7.0 # via code-annotations, user-util code-annotations==0.3.2 # via edx-enterprise +contextlib2==0.5.5 coreapi==2.3.3 # via drf-yasg coreschema==0.0.4 # via coreapi, drf-yasg git+https://github.com/edx/crowdsourcehinter.git@a7ffc85b134b7d8909bf1fefd23dbdb8eb28e467#egg=crowdsourcehinter-xblock==0.2 @@ -162,7 +163,7 @@ mock==1.0.1 git+https://github.com/edx/MongoDBProxy.git@d92bafe9888d2940f647a7b2b2383b29c752f35a#egg=MongoDBProxy==0.1.0+edx.2 mongoengine==0.10.0 mpmath==1.1.0 # via sympy -mysqlclient==1.4.3 +mysqlclient==1.4.4 networkx==1.7 newrelic==4.20.1.121 nltk==3.4.4 @@ -215,7 +216,7 @@ rfc6266-parser==0.0.5.post2 ruamel.ordereddict==0.4.14 ; python_version == "2.7" # via ruamel.yaml ruamel.yaml.clib==0.1.2 # via ruamel.yaml ruamel.yaml==0.16.1 # via drf-yasg -rules==2.0.1 +rules==2.1 s3transfer==0.1.13 # via boto3 sailthru-client==2.2.3 scipy==1.2.1 diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index 2ea0fa9998..954c0fc1de 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -59,7 +59,7 @@ click-log==0.3.2 click==7.0 code-annotations==0.3.2 colorama==0.4.1 -configparser==3.7.4 +configparser==3.8.1 contextlib2==0.5.5 cookies==2.2.1 coreapi==2.3.3 @@ -213,7 +213,7 @@ mongoengine==0.10.0 more-itertools==5.0.0 moto==1.3.1 mpmath==1.1.0 -mysqlclient==1.4.3 +mysqlclient==1.4.4 networkx==1.7 newrelic==4.20.1.121 nltk==3.4.4 @@ -290,7 +290,7 @@ rfc6266-parser==0.0.5.post2 ruamel.ordereddict==0.4.14 ; python_version == "2.7" ruamel.yaml.clib==0.1.2 ruamel.yaml==0.16.1 -rules==2.0.1 +rules==2.1 s3transfer==0.1.13 sailthru-client==2.2.3 scandir==1.10.0 diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index 607877c9b0..6745fbf55f 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -57,8 +57,8 @@ click-log==0.3.2 # via edx-lint click==7.0 code-annotations==0.3.2 colorama==0.4.1 # via radon -configparser==3.7.4 # via entrypoints, flake8, importlib-metadata, pylint -contextlib2==0.5.5 # via importlib-metadata +configparser==3.8.1 # via entrypoints, flake8, importlib-metadata, pylint +contextlib2==0.5.5 cookies==2.2.1 # via moto coreapi==2.3.3 coreschema==0.0.4 @@ -206,7 +206,7 @@ mongoengine==0.10.0 more-itertools==5.0.0 # via pytest moto==1.3.1 mpmath==1.1.0 -mysqlclient==1.4.3 +mysqlclient==1.4.4 networkx==1.7 newrelic==4.20.1.121 nltk==3.4.4 @@ -281,7 +281,7 @@ rfc6266-parser==0.0.5.post2 ruamel.ordereddict==0.4.14 ; python_version == "2.7" ruamel.yaml.clib==0.1.2 ruamel.yaml==0.16.1 -rules==2.0.1 +rules==2.1 s3transfer==0.1.13 sailthru-client==2.2.3 scandir==1.10.0 # via pathlib2