Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

TEST_PASSWORD = "test"


@ddt.ddt
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
class TestAccountAPI(APITestCase):
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/user_api/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ def _get_validation_errors(self, update, serializer):
}

validation_errors['field_errors'] = field_errors
return validation_errors
return validation_errors
1 change: 0 additions & 1 deletion openedx/core/djangoapps/user_api/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

1 change: 1 addition & 0 deletions openedx/core/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
42 changes: 24 additions & 18 deletions pavelib/quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -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"
Expand Down Expand Up @@ -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.
Expand All @@ -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}/"
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down