diff --git a/openedx/core/djangoapps/course_groups/tests/test_cohorts.py b/openedx/core/djangoapps/course_groups/tests/test_cohorts.py index 4f396d32d28c..66a2b6322d9e 100644 --- a/openedx/core/djangoapps/course_groups/tests/test_cohorts.py +++ b/openedx/core/djangoapps/course_groups/tests/test_cohorts.py @@ -225,7 +225,6 @@ def test_get_cohort_with_assign(self): # get_cohort should return a group for user self.assertEquals(cohorts.get_cohort(user, course.id).name, "AutoGroup") - def test_auto_cohorting(self): """ Make sure cohorts.get_cohort() does the right thing with auto_cohort_groups diff --git a/openedx/core/djangoapps/user_api/accounts/tests/test_views.py b/openedx/core/djangoapps/user_api/accounts/tests/test_views.py index 0d91b86da348..e2547a8341d1 100644 --- a/openedx/core/djangoapps/user_api/accounts/tests/test_views.py +++ b/openedx/core/djangoapps/user_api/accounts/tests/test_views.py @@ -13,6 +13,7 @@ TEST_PASSWORD = "test" + @ddt.ddt @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') class TestAccountAPI(APITestCase): @@ -29,7 +30,7 @@ def setUp(self): self.staff_client = APIClient() self.user = UserFactory.create(password=TEST_PASSWORD) - + self.url = reverse("accounts_api", kwargs={'username': self.user.username}) def test_get_account_anonymous_user(self): diff --git a/openedx/core/djangoapps/user_api/accounts/views.py b/openedx/core/djangoapps/user_api/accounts/views.py index 58759e062b21..ff29ec51bfe4 100644 --- a/openedx/core/djangoapps/user_api/accounts/views.py +++ b/openedx/core/djangoapps/user_api/accounts/views.py @@ -157,4 +157,4 @@ def _get_validation_errors(self, update, serializer): } validation_errors['field_errors'] = field_errors - return validation_errors \ No newline at end of file + return validation_errors diff --git a/openedx/core/djangoapps/user_api/tests/test_views.py b/openedx/core/djangoapps/user_api/tests/test_views.py index 02eb0f3e908e..012075054338 100644 --- a/openedx/core/djangoapps/user_api/tests/test_views.py +++ b/openedx/core/djangoapps/user_api/tests/test_views.py @@ -1599,4 +1599,3 @@ def test_update_email_opt_with_invalid_course_key(self): self.assertHttpBadRequest(response) with self.assertRaises(UserOrgTag.DoesNotExist): UserOrgTag.objects.get(user=self.user, org=self.course.id.org, key="email-optin") - diff --git a/openedx/core/operations.py b/openedx/core/operations.py index 363d50c50826..8f25868a131c 100644 --- a/openedx/core/operations.py +++ b/openedx/core/operations.py @@ -10,6 +10,7 @@ def dump_memory(signum, frame): """Dump memory stats for the current process to a temp directory. Uses the meliae output format.""" scanner.dump_all_objects('{}/meliae.{}.{}.dump'.format(tempfile.gettempdir(), datetime.now().isoformat(), os.getpid())) + def install_memory_dumper(dump_signal=signal.SIGPROF): """ Install a signal handler on `signal` to dump memory stats for the current process. diff --git a/pavelib/quality.py b/pavelib/quality.py index a5c7eb4634d7..2b5d8c5757d1 100644 --- a/pavelib/quality.py +++ b/pavelib/quality.py @@ -8,6 +8,24 @@ from .utils.envs import Env +DEFAULT_SYSTEMS = 'lms,cms,common,openedx' + + +def _get_code_directories_for_system(system, subdirectories=['djangoapps', 'lib']): + """ + Returns a string listing the code directories beneath the specified system root. + """ + apps = [system] + + for directory in [subdirectories]: + subdirectory_path = os.path.join(system, directory) + if os.path.isdir(subdirectory_path): + directories = os.listdir(subdirectory_path) + apps.extend([d for d in directories if os.path.isdir(os.path.join(subdirectory_path, d))]) + + return ' '.join(apps) + + @task @needs('pavelib.prereqs.install_python_prereqs') @cmdopts([ @@ -18,20 +36,14 @@ def find_fixme(options): Run pylint on system code, only looking for fixme items. """ num_fixme = 0 - systems = getattr(options, 'system', 'lms,cms,common').split(',') + systems = getattr(options, 'system', DEFAULT_SYSTEMS).split(',') for system in systems: # Directory to put the pylint report in. # This makes the folder if it doesn't already exist. report_dir = (Env.REPORT_DIR / system).makedirs_p() - apps = [system] - - for directory in ['djangoapps', 'lib']: - dirs = os.listdir(os.path.join(system, directory)) - apps.extend([d for d in dirs if os.path.isdir(os.path.join(system, directory, d))]) - - apps_list = ' '.join(apps) + apps_list = _get_code_directories_for_system(system) pythonpath_prefix = ( "PYTHONPATH={system}:{system}/lib" @@ -72,7 +84,7 @@ def run_pylint(options): num_violations = 0 violations_limit = int(getattr(options, 'limit', -1)) errors = getattr(options, 'errors', False) - systems = getattr(options, 'system', 'lms,cms,common').split(',') + systems = getattr(options, 'system', DEFAULT_SYSTEMS).split(',') for system in systems: # Directory to put the pylint report in. @@ -83,13 +95,7 @@ def run_pylint(options): if errors: flags.append("--errors-only") - apps = [system] - - for directory in ['lib']: - dirs = os.listdir(os.path.join(system, directory)) - apps.extend([d for d in dirs if os.path.isdir(os.path.join(system, directory, d))]) - - apps_list = ' '.join(apps) + apps_list = _get_code_directories_for_system(system, subdirectories=['lib']) pythonpath_prefix = ( "PYTHONPATH={system}:{system}/djangoapps:{system}/" @@ -149,7 +155,7 @@ def run_pep8(options): fail the task if too many violations are found. """ num_violations = 0 - systems = getattr(options, 'system', 'lms,cms,common').split(',') + systems = getattr(options, 'system', DEFAULT_SYSTEMS).split(',') violations_limit = int(getattr(options, 'limit', -1)) for system in systems: @@ -238,7 +244,7 @@ def run_quality(options): pythonpath_prefix = ( "PYTHONPATH=$PYTHONPATH:lms:lms/djangoapps:lms/lib:cms:cms/djangoapps:cms/lib:" - "common:common/djangoapps:common/lib" + "common:common/djangoapps:common/lib:openedx:openedx/core:openedx/core/djangoapps" ) try: