Commit Graph

47 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
usamasadiq
7bbde8f0f5 Applied pylint-amnesty 2021-02-08 13:00:22 +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
Ayub khan
ad2423fcc3 python3 compatibility 2019-07-09 15:22:19 +05:00
Matthew Piatetsky
7df30938c4 fix unicode strings in cms/ 2019-02-04 13:01:51 -05:00
cclauss
8fca11b85c Use print() function in both Python 2 and Python 3 2019-01-13 17:16:37 +01:00
Nimisha Asthagiri
4a9063d83b course_structures: remove usages 2018-07-02 12:36:34 -04:00
Andy Armstrong
ebb04ca396 Reorder Studio imports using isort 2017-05-30 17:00:50 -04:00
Nimisha Asthagiri
e83182c743 Have generate_course_blocks pass with_storage option to celery tasks 2017-03-20 16:22:44 -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
Eric Fischer
8f0134b7e4 update_course_in_cache should retry on exceptions
Previously, retry() was never called, so the task was never retried despite
defining several retry-related variables.
2016-10-19 14:09:28 -04:00
Eric Fischer
fdc6d91588 update_in_cache on lms worker (#12689)
This commit "undoes"a previous hotfix, and allows a cms course_publish
signal to trigger a block_structure update_course_in_cache task, which
is run on an lms worker queue.

Changes:
    -exposes ALTERNATE_QUEUE_ENVS
    -adds routing layer in celery.py
    -moves prior dev_with_worker settings file to devstack_with_worker
    -moves course_block api functionality into openedx/core/djangoapps/content/block_structure
2016-06-16 18:01:06 -04:00
Calen Pennington
18e1610043 Remove the create_user argument to setUp.
Instead, use a class attribute to define test behavior. This allows for
easier addition of new mixins over time.
2016-05-04 11:35:55 -04:00
Sarina Canelake
c450145f7b Update CMS Contentstore tests to not use ORA1 examples 2015-12-11 15:05:01 -05:00
Ned Batchelder
f54fe787c6 Remove needless 'disable=no-member' pragmas 2015-08-03 17:47:44 -04:00
Syed Hassan Raza
103fa38860 edx-val-Fix VAL error on re-import 2015-05-11 20:00:55 +05:00
Davorin Sego
e37a98d1be Indexing moved to celery task. Reorganised indexing to always allow for full course reindex. Indexing code no longer needs to be in common, because it is triggered by signal instead of being called.g 2015-04-10 14:30:19 -04:00
Clinton Blackburn
9a8ecc65a7 Removed invalid kwarg 2015-03-27 10:37:04 -04:00
Jonathan Piacenti
8ad4d081fb Added library import and export via .tar.gz'd XML files. 2015-03-10 21:29:29 +00:00
cahrens
d88b0c488e store.has_course fails on old mongo with unicode chars.
xml_importer now calls store.has_course even if create_course_if_not_present is False.
2015-02-09 10:00:33 -05:00
cahrens
149c4e78c1 Update tests in reaction to ModuleStoreTestCase cleanup. 2015-02-09 10:00:32 -05:00
cahrens
040f96223c Update for split modulestore as default. 2015-02-09 10:00:14 -05:00
John Eskew
94ea35d3be Export modulestore-stored asset metadata as XML to exported course.
Import asset metadata XML into modulestore.
Optimize importing many items of asset metadata by avoiding multiple
round-trips to MongoDB.
2014-12-16 15:42:38 -05:00
Sarina Canelake
19f1dacab2 s/pylint: disable=E1101/pylint: disable=no-member/ 2014-12-01 11:22:09 -05:00
muhammad-ammar
fcaa783e43 Unit Test Improvements
TE-489
2014-10-31 11:55:13 +00:00
Calen Pennington
52beec8878 Switch inheritance in split-mongo over to using InheritingFieldData. 2014-09-29 22:35:40 -04:00
Nimisha Asthagiri
b6590228a3 LMS-11342 Fix Split reimport issue. 2014-09-03 23:03:00 -04:00
Calen Pennington
337b0b48aa Improve check_number_of_calls family of methods 2014-08-27 16:29:47 -04:00
Nimisha Asthagiri
84992cdfa5 Refactor xml_importer.py for easier reading.
Remove post-publish step.
2014-08-08 14:41:57 -04:00
Nimisha Asthagiri
775b50a736 Address code coverage and quality. 2014-08-08 08:31:14 -04:00
Nimisha Asthagiri
cd33165a52 Unit test for import performance STUD-1994 2014-07-24 16:34:26 -04:00
cahrens
77702fae09 Getting draft split_test_module instances to import/export.
STUD-327
2014-07-23 11:27:23 -04:00
Nimisha Asthagiri
d7cf8b7fa0 Implement close_connections and drop_database on modulestores. 2014-07-14 16:01:10 -04:00
Nimisha Asthagiri
ea32529866 Fix all modulestore calls to pass in user ids. 2014-07-09 21:10:12 -04:00
Don Mitchell
cc6dfbbc75 Asset support in split
LMS-2876
2014-07-07 17:11:43 -04:00
Calen Pennington
1c882da397 Make Studio able to handle deprecated key formats in urls 2014-06-30 14:29:10 -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
cfcbdc0145 Move to OpaqueKey implementations from the external library
[LMS-2757]
2014-05-29 17:03:35 -04:00
Calen Pennington
8534ef559d Fix cms tests after merge from master 2014-05-13 16:33:14 -04:00
Calen Pennington
6c546fbf1f Fix merge conflicts 2014-05-13 15:31:40 -04:00
Calen Pennington
240d91daeb Merge remote-tracking branch 'edx/master' into opaque-keys-merge-master
Conflicts:
	cms/djangoapps/contentstore/management/commands/tests/test_import.py
	cms/djangoapps/contentstore/tests/test_import.py
	common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py
	common/lib/xmodule/xmodule/modulestore/xml_importer.py
	lms/djangoapps/bulk_email/tests/test_course_optout.py
	lms/djangoapps/bulk_email/tests/test_email.py
	lms/djangoapps/bulk_email/tests/test_err_handling.py
	lms/djangoapps/class_dashboard/tests/test_dashboard_data.py
	lms/djangoapps/courseware/courses.py
	lms/djangoapps/django_comment_client/base/views.py
	lms/djangoapps/instructor/tests/test_email.py
	lms/djangoapps/instructor/tests/test_legacy_anon_csv.py
	lms/djangoapps/instructor/tests/test_legacy_download_csv.py
	lms/djangoapps/instructor/tests/test_legacy_email.py
	lms/djangoapps/instructor/tests/test_legacy_enrollment.py
	lms/djangoapps/instructor/tests/test_legacy_forum_admin.py
	lms/djangoapps/instructor/tests/test_legacy_gradebook.py
	lms/djangoapps/instructor/tests/test_legacy_raw_download_csv.py
	lms/djangoapps/instructor/tests/test_legacy_reset.py
	lms/djangoapps/instructor/views/api.py
	lms/djangoapps/instructor/views/instructor_dashboard.py
	lms/djangoapps/instructor/views/legacy.py
	lms/templates/courseware/instructor_dashboard.html
2014-05-13 15:30:56 -04:00
Adam Palay
a51a0c558e fix importing bug (STUD-1599)
add target_location_namespace check
2014-05-12 15:59:41 -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
zubiar-arbi
00bf5e4fce use unicode strings for slug and regex
STUD-1433
2014-03-21 15:48:29 +05:00
Jay Zoldak
c5a7911b87 Fix pylint disable pragmas that were pep8 violations 2014-03-20 10:18:40 -04:00
Diana Huang
bce7d9e43d Add tests and clean up A/B testing
Also fixes STUD-1351
2014-03-05 13:46:03 -05:00
cahrens
894c40b89d Change Reference and ReferenceList instances on import to new namespace.
STUD-149
2014-02-12 15:22:12 -05:00