Skip to content

Commit

Permalink
Merge branch 'master' into pkg_resources-depr
Browse files Browse the repository at this point in the history
  • Loading branch information
irtazaakram committed Jan 7, 2025
2 parents f14659c + 85ecad1 commit c39b574
Show file tree
Hide file tree
Showing 70 changed files with 1,599 additions and 2,460 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pylint-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- module-name: openedx-2
path: "openedx/core/djangoapps/geoinfo/ openedx/core/djangoapps/header_control/ openedx/core/djangoapps/heartbeat/ openedx/core/djangoapps/lang_pref/ openedx/core/djangoapps/models/ openedx/core/djangoapps/monkey_patch/ openedx/core/djangoapps/oauth_dispatch/ openedx/core/djangoapps/olx_rest_api/ openedx/core/djangoapps/password_policy/ openedx/core/djangoapps/plugin_api/ openedx/core/djangoapps/plugins/ openedx/core/djangoapps/profile_images/ openedx/core/djangoapps/programs/ openedx/core/djangoapps/safe_sessions/ openedx/core/djangoapps/schedules/ openedx/core/djangoapps/service_status/ openedx/core/djangoapps/session_inactivity_timeout/ openedx/core/djangoapps/signals/ openedx/core/djangoapps/site_configuration/ openedx/core/djangoapps/system_wide_roles/ openedx/core/djangoapps/theming/ openedx/core/djangoapps/user_api/ openedx/core/djangoapps/user_authn/ openedx/core/djangoapps/util/ openedx/core/djangoapps/verified_track_content/ openedx/core/djangoapps/video_config/ openedx/core/djangoapps/video_pipeline/ openedx/core/djangoapps/waffle_utils/ openedx/core/djangoapps/xblock/ openedx/core/djangoapps/xmodule_django/ openedx/core/tests/ openedx/features/ openedx/testing/ openedx/tests/ openedx/core/djangoapps/notifications/ openedx/core/djangoapps/staticfiles/ openedx/core/djangoapps/content_tagging/"
- module-name: common
path: "common pavelib"
path: "common"
- module-name: cms
path: "cms"
- module-name: xmodule
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/unit-test-shards.json
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,13 @@
"common-with-lms": {
"settings": "lms.envs.test",
"paths": [
"common/djangoapps/",
"pavelib/"
"common/djangoapps/"
]
},
"common-with-cms": {
"settings": "cms.envs.test",
"paths": [
"common/djangoapps/",
"pavelib/"
"common/djangoapps/"
]
},
"xmodule-with-lms": {
Expand Down
26 changes: 2 additions & 24 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,29 +71,7 @@ jobs:

- name: install system requirements
run: |
sudo apt-get update && sudo apt-get install libmysqlclient-dev libxmlsec1-dev lynx openssl
# This is needed until the ENABLE_BLAKE2B_HASHING can be removed and we
# can stop using MD4 by default.
- name: enable md4 hashing in libssl
run: |
cat <<EOF | sudo tee /etc/ssl/openssl.cnf
# Use this in order to automatically load providers.
openssl_conf = openssl_init
[openssl_init]
providers = provider_sect
[provider_sect]
default = default_sect
legacy = legacy_sect
[default_sect]
activate = 1
[legacy_sect]
activate = 1
EOF
sudo apt-get update && sudo apt-get install libmysqlclient-dev libxmlsec1-dev lynx
- name: Start MongoDB
uses: supercharge/[email protected]
Expand Down Expand Up @@ -180,7 +158,7 @@ jobs:
shell: bash
run: |
echo "root_cms_unit_tests_count=$(pytest --disable-warnings --collect-only --ds=cms.envs.test cms/ -q | head -n -2 | wc -l)" >> $GITHUB_ENV
echo "root_lms_unit_tests_count=$(pytest --disable-warnings --collect-only --ds=lms.envs.test lms/ openedx/ common/djangoapps/ xmodule/ pavelib/ -q | head -n -2 | wc -l)" >> $GITHUB_ENV
echo "root_lms_unit_tests_count=$(pytest --disable-warnings --collect-only --ds=lms.envs.test lms/ openedx/ common/djangoapps/ xmodule/ -q | head -n -2 | wc -l)" >> $GITHUB_ENV
- name: get GHA unit test paths
shell: bash
Expand Down
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ requirements: dev-requirements ## install development environment requirements
# Order is very important in this list: files must appear after everything they include!
REQ_FILES = \
requirements/edx/coverage \
requirements/edx/paver \
requirements/edx-sandbox/base \
requirements/edx/base \
requirements/edx/doc \
Expand Down Expand Up @@ -179,7 +178,7 @@ xsslint: ## check xss for quality issuest
--config=scripts.xsslint_config \
--thresholds=scripts/xsslint_thresholds.json

pycodestyle: ## check python files for quality issues
pycodestyle: ## check python files for quality issues
pycodestyle .

## Re-enable --lint flag when this issue https://github.com/openedx/edx-platform/issues/35775 is resolved
Expand All @@ -190,13 +189,13 @@ pii_check: ## check django models for pii annotations
--app_name cms \
--coverage \
--lint

DJANGO_SETTINGS_MODULE=lms.envs.test \
code_annotations django_find_annotations \
--config_file .pii_annotations.yml \
--app_name lms \
--coverage \
--lint
--lint

check_keywords: ## check django models for reserve keywords
DJANGO_SETTINGS_MODULE=cms.envs.test \
Expand Down
3 changes: 0 additions & 3 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,6 @@
# .. toggle_tickets: https://github.com/openedx/edx-platform/pull/33911
'ENABLE_GRADING_METHOD_IN_PROBLEMS': False,

# See annotations in lms/envs/common.py for details.
'ENABLE_BLAKE2B_HASHING': False,

# .. toggle_name: FEATURES['BADGES_ENABLED']
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
Expand Down
6 changes: 1 addition & 5 deletions common/djangoapps/util/memcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,14 @@
import hashlib
from urllib.parse import quote_plus

from django.conf import settings
from django.utils.encoding import smart_str


def fasthash(string):
"""
Hashes `string` into a string representation of a 128-bit digest.
"""
if settings.FEATURES.get("ENABLE_BLAKE2B_HASHING", False):
hash_obj = hashlib.new("blake2b", digest_size=16)
else:
hash_obj = hashlib.new("md4")
hash_obj = hashlib.new("blake2b", digest_size=16)
hash_obj.update(string.encode('utf-8'))
return hash_obj.hexdigest()

Expand Down
48 changes: 1 addition & 47 deletions common/djangoapps/util/tests/test_memcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
"""


from django.conf import settings
from django.core.cache import caches
from django.test import TestCase, override_settings
from django.test import TestCase

from common.djangoapps.util.memcache import safe_key

BLAKE2B_ENABLED_FEATURES = settings.FEATURES.copy()
BLAKE2B_ENABLED_FEATURES["ENABLE_BLAKE2B_HASHING"] = True


class MemcacheTest(TestCase):
"""
Expand Down Expand Up @@ -55,20 +51,6 @@ def test_safe_key_long(self):
# The key should now be valid
assert self._is_valid_key(key), f'Failed for key length {length}'

@override_settings(FEATURES=BLAKE2B_ENABLED_FEATURES)
def test_safe_key_long_with_blake2b_enabled(self):
# Choose lengths close to memcached's cutoff (250)
for length in [248, 249, 250, 251, 252]:

# Generate a key of that length
key = 'a' * length

# Make the key safe
key = safe_key(key, '', '')

# The key should now be valid
assert self._is_valid_key(key), f'Failed for key length {length}'

def test_long_key_prefix_version(self):

# Long key
Expand All @@ -83,34 +65,6 @@ def test_long_key_prefix_version(self):
key = safe_key('key', 'prefix', 'a' * 300)
assert self._is_valid_key(key)

@override_settings(FEATURES=BLAKE2B_ENABLED_FEATURES)
def test_long_key_prefix_version_with_blake2b_enabled(self):

# Long key
key = safe_key('a' * 300, 'prefix', 'version')
assert self._is_valid_key(key)

# Long prefix
key = safe_key('key', 'a' * 300, 'version')
assert self._is_valid_key(key)

# Long version
key = safe_key('key', 'prefix', 'a' * 300)
assert self._is_valid_key(key)

def test_safe_key_unicode(self):

for unicode_char in self.UNICODE_CHAR_CODES:

# Generate a key with that character
key = chr(unicode_char)

# Make the key safe
key = safe_key(key, '', '')

# The key should now be valid
assert self._is_valid_key(key), f'Failed for unicode character {unicode_char}'

def test_safe_key_prefix_unicode(self):

for unicode_char in self.UNICODE_CHAR_CODES:
Expand Down
Binary file modified common/static/data/geoip/GeoLite2-Country.mmdb
Binary file not shown.
Loading

0 comments on commit c39b574

Please sign in to comment.