In Django template rendering, context processors only run once.
But when we do template rendering through edxmako (which we do for
each and every web fragment/XBlock), we can end up having hundreds
of invocations of templates and run context processors for each
separately. This removes that work.
This adds request caching to the following places:
* course expiration wrapper (displayed in Units)
* offer banner generation (displayed in Units)
* get_enrollment
* user_by_anonymous_id
* youtube_disabled_for_course
On a sample course with edx-val enabled, this reduced the queries
for a large sequence from 450 to 155.
In the script used to create the bok-choy database cache files, we've been passing in the parameters to omit timestamps that change for every run in some of the mysqldump commands but not all of them. Use them consistently so we can stop creating new redundant automated bok-choy DB cache PRs on almost every merge to edx-platform.
Fix the issue that was preventing us from upgrading pytest. pytest does some manipulation of test packages that prevents `pkg_resources` from loading resources from them, but used to contain a workaround for the problem. That workaround was [removed](https://github.com/pytest-dev/pytest/issues/5392) in 4.6.0 as a performance enhancement when pytest switched from `pkg_resources` to `importlib-metadata` for its own entrypoint handling. This tripped up one of our test modules which defined classes that loaded templates from inside a test package. Moving these resources to the parent package fixes the problem.
More and more, `pkg_resources` is being abandoned in favor of `importlib-metadata` and `importlib_resources` as they have a simpler design with much better performance. However, `importlib_resources` doesn't support loading files from any directory which isn't itself a Python package (and doesn't allow direct use of paths including directories within the package). Jinja2 chose a [different approach](https://github.com/pallets/jinja/pull/1082) that we may want to emulate in our resource handling.
Also fixed usage of a removed `pytest.raises()` parameter and a bug in our configuration of the `common/lib` tests that became a problem after the upgrade.
Specifying a namespace in django.conf.urls.include() without providing an app_name is deprecated.
Adding the app_name attribute in the included module.
The MockS3Mixin prevents the correct setup of the ModuleStoreTestCase
and made this test fail. Since the fix for this wasn't trivial, this
test was skipped on python 3, and now is removed.
A user's last logged in value previously wasn't updated when the user
logs in through the oauth2 flow from the ios mobile app. Here we must
send the user_logged_in signal manually. It's implemented in the
my_user_info mobile rest api endpoint because adding it to where the
oauth2 flow happens is to complex, and the mobile app hits this endpoint
after a successful login anyway.