Merge pull request #25811 from edx/usamasadiq/bom-1740-post-python38-cleanup

Post Python38 clean up process
This commit is contained in:
Usama Sadiq
2021-02-01 17:19:21 +05:00
committed by GitHub
5 changed files with 4 additions and 86 deletions

View File

@@ -32,12 +32,6 @@ from xmodule.errortracker import make_error_tracker
from .exceptions import InsufficientSpecificationError, InvalidLocationError
# The name of the type for patterns in re changed in Python 3.7.
try:
Pattern = re._pattern_type # pylint: disable=protected-access
except AttributeError:
Pattern = re.Pattern # pylint: disable=no-member
log = logging.getLogger('edx.modulestore')
new_contract('CourseKey', CourseKey)
@@ -905,7 +899,7 @@ class ModuleStoreRead(six.with_metaclass(ABCMeta, ModuleStoreAssetBase)):
"""
if isinstance(target, list):
return any(self._value_matches(ele, criteria) for ele in target)
elif isinstance(criteria, Pattern):
elif isinstance(criteria, re.Pattern):
return criteria.search(target) is not None
elif callable(criteria):
return criteria(target)

View File

@@ -158,13 +158,3 @@ def normalize_repr(func):
between worker processes.
"""
return reprwrapper(func)
# Decorator for skipping tests that are not ready to be run with Python 3.x.
# While we expect many tests to fail with Python 3.x as we transition, this
# is specifically for tests that rely on external or large scale fixes. It can
# be added to individual tests or test classes.
py2_only = pytest.mark.skipif(
sys.version_info > (3, 0),
reason="This test can only be run with Python 2.7, currently"
)

View File

@@ -951,10 +951,6 @@ class CategoryMapTestCase(CategoryMapTestMixin, ModuleStoreTestCase):
}
)
@pytest.mark.skipif(
sys.version_info < (3, 7),
reason="Python 3.7 sorted dict insertion is considered"
)
def test_sort_intermediates(self):
self.create_discussion("Chapter B", "Discussion 2")
self.create_discussion("Chapter C", "Discussion")
@@ -1015,70 +1011,6 @@ class CategoryMapTestCase(CategoryMapTestMixin, ModuleStoreTestCase):
}
)
@pytest.mark.skipif(
sys.version_info >= (3, 7),
reason="Python 3.7 sorted dict insertion is not considered"
)
def test_sort_intermediates(self):
self.create_discussion("Chapter B", "Discussion 2")
self.create_discussion("Chapter C", "Discussion")
self.create_discussion("Chapter A", "Discussion 1")
self.create_discussion("Chapter B", "Discussion 1")
self.create_discussion("Chapter A", "Discussion 2")
self.assert_category_map_equals(
{
"entries": {},
"subcategories": {
"Chapter A": {
"entries": {
"Discussion 1": {
"id": "discussion3",
"sort_key": None,
"is_divided": False,
},
"Discussion 2": {
"id": "discussion5",
"sort_key": None,
"is_divided": False,
}
},
"subcategories": {},
"children": [("Discussion 1", TYPE_ENTRY), ("Discussion 2", TYPE_ENTRY)]
},
"Chapter B": {
"entries": {
"Discussion 1": {
"id": "discussion4",
"sort_key": None,
"is_divided": False,
},
"Discussion 2": {
"id": "discussion1",
"sort_key": None,
"is_divided": False,
}
},
"subcategories": {},
"children": [("Discussion 1", TYPE_ENTRY), ("Discussion 2", TYPE_ENTRY)]
},
"Chapter C": {
"entries": {
"Discussion": {
"id": "discussion2",
"sort_key": None,
"is_divided": False,
}
},
"subcategories": {},
"children": [("Discussion", TYPE_ENTRY)]
}
},
"children": [("Chapter A", TYPE_SUBCATEGORY), ("Chapter B", TYPE_SUBCATEGORY),
("Chapter C", TYPE_SUBCATEGORY)]
}
)
def test_ids_empty(self):
self.assertEqual(utils.get_discussion_categories_ids(self.course, self.user), [])

View File

@@ -0,0 +1 @@
Django>=3.1,<3.2

View File

@@ -1,5 +1,5 @@
[tox]
envlist = py{35}-django{22},py{38}-django{22,30}
envlist = py{38}-django{22,30,31}
# This is needed to prevent the lms, cms, and openedx packages inside the "Open
# edX" package (defined in setup.py) from getting installed into site-packages
@@ -70,6 +70,7 @@ passenv =
deps =
django22: -r requirements/edx/django.txt
django30: -r requirements/edx/django30.txt
django31: -r requirements/edx/django31.txt
-r requirements/edx/testing.txt
whitelist_externals =
/bin/bash