cleanup references of python 2 & <3.11 (#35799)
* chore: cleanup of old python references
This commit is contained in:
@@ -32,4 +32,4 @@ You'd have to update the `unit-test-shards.json` file manually to fix this.
|
||||
```
|
||||
pytest --collect-only --ds=cms.envs.test cms/
|
||||
```
|
||||
For more details on how this check collects and compares the unit tests count please take a look at [verify unit tests count](../.github/workflows/verify-gha-unit-tests-count.yml)
|
||||
For more details on how this check collects and compares the unit tests count please take a look at [verify unit tests count](../.github/workflows/unit-tests.yml)
|
||||
|
||||
@@ -29,11 +29,11 @@ To download the scripts, you can perform a partial clone of the edx-platform rep
|
||||
Create Python Virtual Environment
|
||||
---------------------------------
|
||||
|
||||
Create a Python virtual environment using Python 3.8:
|
||||
Create a Python virtual environment using Python 3.11:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
python3.8 -m venv ../venv
|
||||
python3.11 -m venv ../venv
|
||||
source ../venv/bin/activate
|
||||
|
||||
Install Pip Packages
|
||||
|
||||
@@ -28,11 +28,11 @@ To download the scripts, you can perform a partial clone of the edx-platform rep
|
||||
Create Python Virtual Environment
|
||||
---------------------------------
|
||||
|
||||
Create a Python virtual environment using Python 3.8:
|
||||
Create a Python virtual environment using Python 3.11:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
python3.8 -m venv ../venv
|
||||
python3.11 -m venv ../venv
|
||||
source ../venv/bin/activate
|
||||
|
||||
Install Pip Packages
|
||||
|
||||
@@ -43,12 +43,11 @@ def _fail(kind, code, message):
|
||||
"""
|
||||
_log(kind, message)
|
||||
|
||||
# Try to get a traceback, if there is one. On Python 3.4 this raises an AttributeError
|
||||
# if there is no current exception, so we eat that here.
|
||||
try:
|
||||
_log(kind, traceback.format_exc())
|
||||
except AttributeError:
|
||||
pass
|
||||
# Log the traceback if an exception is currently being handled
|
||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||
if exc_type is not None:
|
||||
traceback_str = traceback.format_exception(exc_type, exc_value, exc_traceback)
|
||||
_log(kind, ''.join(traceback_str))
|
||||
|
||||
sys.exit(code)
|
||||
|
||||
@@ -66,16 +65,12 @@ def _get_error_str_from_exception(exc):
|
||||
"""
|
||||
Return a string from an exception that may or may not have a .content (Slumber)
|
||||
"""
|
||||
exc_msg = text_type(exc)
|
||||
exc_msg = str(exc)
|
||||
|
||||
if hasattr(exc, 'content'):
|
||||
# Slumber inconveniently discards the decoded .text attribute from the Response object,
|
||||
# and instead gives us the raw encoded .content attribute, so we need to decode it first.
|
||||
# Python 2 needs the decode, Py3 does not have it.
|
||||
try:
|
||||
exc_msg += '\n' + str(exc.content).decode('utf-8')
|
||||
except AttributeError:
|
||||
exc_msg += '\n' + str(exc.content)
|
||||
# Attempt to decode `exc.content` if it's in bytes, otherwise just convert to str
|
||||
exc_content = exc.content.decode('utf-8') if isinstance(exc.content, bytes) else str(exc.content)
|
||||
exc_msg += '\n' + exc_content
|
||||
|
||||
return exc_msg
|
||||
|
||||
|
||||
Reference in New Issue
Block a user