Commit Graph

30 Commits

Author SHA1 Message Date
M. Zulqarnain
fa271dafe9 BOM-2369 (C): pyupgrade on contentstore/tests (#26759)
* pyupgrade on contentstore/tests
2021-03-04 14:37:39 +05:00
Kyle McCormick
151bd13666 Use full names for common.djangoapps imports; warn when using old style (#25477)
* Generate common/djangoapps import shims for LMS
* Generate common/djangoapps import shims for Studio
* Stop appending project root to sys.path
* Stop appending common/djangoapps to sys.path
* Import from common.djangoapps.course_action_state instead of course_action_state
* Import from common.djangoapps.course_modes instead of course_modes
* Import from common.djangoapps.database_fixups instead of database_fixups
* Import from common.djangoapps.edxmako instead of edxmako
* Import from common.djangoapps.entitlements instead of entitlements
* Import from common.djangoapps.pipline_mako instead of pipeline_mako
* Import from common.djangoapps.static_replace instead of static_replace
* Import from common.djangoapps.student instead of student
* Import from common.djangoapps.terrain instead of terrain
* Import from common.djangoapps.third_party_auth instead of third_party_auth
* Import from common.djangoapps.track instead of track
* Import from common.djangoapps.util instead of util
* Import from common.djangoapps.xblock_django instead of xblock_django
* Add empty common/djangoapps/__init__.py to fix pytest collection
* Fix pylint formatting violations
* Exclude import_shims/ directory tree from linting
2020-11-10 07:02:01 -05:00
Kyle McCormick
538dbf696b Import CMS code using fully qualified module names
or, using proper the proper Python 3 relative imports
(e.g., 'from .views import x') which are standard and
unambiguous.
2020-10-19 09:34:31 -04:00
Feanil Patel
2df8b8226b Merge pull request #22643 from edx/feanil/2to3_asserts
Run `2to3 -f asserts . -w` on edx-platform.
2019-12-30 12:13:42 -05:00
Feanil Patel
9cf2f9f298 Run 2to3 -f future . -w
This will remove imports from __future__ that are no longer needed.

https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
2019-12-30 10:35:30 -05:00
Feanil Patel
70294b0ad2 Run 2to3 -f asserts . -w on edx-platform.
https://docs.python.org/3.5/library/2to3.html#2to3fixer-asserts
2019-12-30 10:22:19 -05:00
amitvadhel
77ac61212b Updates for TypeError in Python 3 2019-09-08 13:02:55 +03:00
Ayub khan
4ed93be5ff INCR-328 python3 compatibility 2019-07-09 13:09:08 +05:00
Matthew Piatetsky
7df30938c4 fix unicode strings in cms/ 2019-02-04 13:01:51 -05:00
Andy Armstrong
ebb04ca396 Reorder Studio imports using isort 2017-05-30 17:00:50 -04:00
David Ormsbee
2051c90924 Test Speedup: Isolate Modulestore Signals
There are a number of Django Signals that are on the modulestore's
SignalHandler class, such as SignalHandler.course_published. These
signals can trigger very expensive processes to occur, such as course
overview or block structures generation. Most of the time, the test
author doesn't care about these side-effects.

This commit does a few things:

* Converts the signals on SignalHandler to be instances of a new
  SwitchedSignal class, that allows signal sending to be disabled.

* Creates a SignalIsolationMixin helper similar in spirit to the
  CacheIsolationMixin, and adds it to the ModuleStoreIsolationMixin
  (and thus to ModuleStoreTestCase and SharedModuleStoreTestCase).

* Converts our various tests to use this new mechanism. In some cases,
  this means adjusting query counts downwards because they no longer
  have to account for publishing listener actions.

Modulestore generated signals are now muted by default during test runs.
Calls to send() them will result in no-ops. You can choose to enable
specific signals for a given subclass of ModuleStoreTestCase or
SharedModuleStoreTestCase by specifying an ENABLED_SIGNALS class
attribute, like the following example:

    from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase

    class MyPublishTestCase(ModuleStoreTestCase):
        ENABLED_SIGNALS = ['course_published', 'pre_publish']

You should take great care when disabling signals outside of a
ModuleStoreTestCase or SharedModuleStoreTestCase, since they can leak
out into other tests. Be sure to always clean up, and never disable
signals outside of testing. Because signals are essentially process
globals, it can have a lot of unpleasant side-effects if we start
mucking around with them during live requests.

Overall, this change has cut the total test execution time for
edx-platform by a bit over a third, though we still spend a lot in
pre-test setup during our test builds.

[PERF-413]
2017-02-23 10:31:16 -05:00
Nimisha Asthagiri
74a3665289 Update query and mongo counts 2016-06-23 20:22:32 -04:00
Adam Palay
72e7ac5d4c do orphan deletion in a bulk operation (SUST-21) 2015-12-02 13:33:59 -05:00
Awais Jibran
2813b1269e Published orphans in split breaks preview button in Studio 2015-10-12 15:00:49 +05:00
Adam Palay
8aa23de55a add ability to delete published orphans from courses (PLAT-832)
fix quality violations

create child parent mapping to avoid potential performance hit when deleting items
2015-09-17 11:52:19 -04:00
Adam Palay
8834bbad90 delete_item should not delete any child that has a parent we do not intend to delete 2015-09-17 11:52:18 -04:00
Ned Batchelder
7d799e34f3 Remove unused imports 2015-03-17 07:10:31 -04:00
Adam Palay
7837607ca9 only recusively delete modules if all their parents are marked for deletion (PLAT-333)
update '_delete_item' method for draft only modules and update delete_orphans management command

fix test_courseware which fails due to invalid future date
2015-01-05 14:54:17 -05:00
Calen Pennington
483e2a6a5d split create_item and create_child out as separate methods 2014-07-18 21:11:37 -04:00
Nimisha Asthagiri
7efd0cb49e converge Split APIs with Mixed and Draft 2014-07-17 22:48:11 -04:00
Nimisha Asthagiri
a9213509c3 Enable Mixed Modulestore STUD-1540
Refactor get_parent_locations STUD-1663
2014-06-26 18:00:11 -04:00
Calen Pennington
0d88379eeb Make course ids and usage ids opaque to LMS and Studio [partial commit]
This commit adds all of cms.

These keys are now objects with a limited interface, and the particular
internal representation is managed by the data storage layer (the
modulestore).

For the LMS, there should be no outward-facing changes to the system.
The keys are, for now, a change to internal representation only. For
Studio, the new serialized form of the keys is used in urls, to allow
for further migration in the future.

Co-Author: Andy Armstrong <andya@edx.org>
Co-Author: Christina Roberts <christina@edx.org>
Co-Author: David Baumgold <db@edx.org>
Co-Author: Diana Huang <dkh@edx.org>
Co-Author: Don Mitchell <dmitchell@edx.org>
Co-Author: Julia Hansbrough <julia@edx.org>
Co-Author: Nimisha Asthagiri <nasthagiri@edx.org>
Co-Author: Sarina Canelake <sarina@edx.org>

[LMS-2370]
2014-05-07 12:56:43 -04:00
Nimisha Asthagiri
d865e9096e Add the ability to reorder Pages and hide the Wiki page. 2014-03-28 05:39:03 -04:00
cahrens
09d90b16af Clean up of modulestore references (primarly LMS).
STUD-1151
2014-02-11 14:29:22 -05:00
Don Mitchell
b8ea7f3c43 update_item and other refactorings continued 2014-02-05 10:24:24 -05:00
Don Mitchell
c601b75675 MixedModulestore wraps most getters, update_item, delete_item
with code to translate between addressing schemes based on app
and persistence layer addressing scheme specification.

STUD-1206
2014-02-05 09:34:30 -05:00
Don Mitchell
f45abe3d9f Use new restful pattern instead 2013-10-24 13:18:23 -04:00
Don Mitchell
4e455fd87f Limit read access to people with write access.
Add unit tests for auth
2013-10-24 13:18:22 -04:00
Don Mitchell
e9c70633c6 Add delete if staff member 2013-10-24 13:18:22 -04:00
Don Mitchell
6b9797522b Write restful service to find all orphans
To help fix recent bugs re orphaned discussions and
to prototype a more restful json oriented api.
2013-10-24 13:18:22 -04:00