diff --git a/.gitignore b/.gitignore index 7dc4ee8dd4..dce113d0e7 100644 --- a/.gitignore +++ b/.gitignore @@ -73,6 +73,7 @@ cover_html/ reports/ jscover.log jscover.log.* +.pytest_cache/ .tddium* common/test/data/test_unicode/static/ test_root/courses/ diff --git a/common/djangoapps/track/backends/tests/test_logger.py b/common/djangoapps/track/backends/tests/test_logger.py index dbe59cdf19..9c98629ed9 100644 --- a/common/djangoapps/track/backends/tests/test_logger.py +++ b/common/djangoapps/track/backends/tests/test_logger.py @@ -6,73 +6,33 @@ import json import logging import datetime -from django.test import TestCase - from track.backends.logger import LoggerBackend -class TestLoggerBackend(TestCase): - def setUp(self): - super(TestLoggerBackend, self).setUp() - self.handler = MockLoggingHandler() - self.handler.setLevel(logging.INFO) - - logger_name = 'track.backends.logger.test' - logger = logging.getLogger(logger_name) - logger.addHandler(self.handler) - - self.backend = LoggerBackend(name=logger_name) - - def test_logger_backend(self): - self.handler.reset() - - # Send a couple of events and check if they were recorded - # by the logger. The events are serialized to JSON. - - event = { - 'test': True, - 'time': datetime.datetime(2012, 05, 01, 07, 27, 01, 200), - 'date': datetime.date(2012, 05, 07), - } - - self.backend.send(event) - self.backend.send(event) - - saved_events = [json.loads(e) for e in self.handler.messages['info']] - - unpacked_event = { - 'test': True, - 'time': '2012-05-01T07:27:01.000200+00:00', - 'date': '2012-05-07' - } - - self.assertEqual(saved_events[0], unpacked_event) - self.assertEqual(saved_events[1], unpacked_event) - - -class MockLoggingHandler(logging.Handler): +def test_logger_backend(caplog): """ - Mock logging handler. - - Stores records in a dictionry of lists by level. - + Send a couple of events and check if they were recorded + by the logger. The events are serialized to JSON. """ + caplog.set_level(logging.INFO) + logger_name = 'track.backends.logger.test' + backend = LoggerBackend(name=logger_name) + event = { + 'test': True, + 'time': datetime.datetime(2012, 5, 1, 7, 27, 1, 200), + 'date': datetime.date(2012, 5, 7), + } - def __init__(self, *args, **kwargs): - super(MockLoggingHandler, self).__init__(*args, **kwargs) - self.messages = None - self.reset() + backend.send(event) + backend.send(event) - def emit(self, record): - level = record.levelname.lower() - message = record.getMessage() - self.messages[level].append(message) + saved_events = [json.loads(e[2]) for e in caplog.record_tuples if e[0] == logger_name] - def reset(self): - self.messages = { - 'debug': [], - 'info': [], - 'warning': [], - 'error': [], - 'critical': [], - } + unpacked_event = { + 'test': True, + 'time': '2012-05-01T07:27:01.000200+00:00', + 'date': '2012-05-07' + } + + assert saved_events[0] == unpacked_event + assert saved_events[1] == unpacked_event diff --git a/common/lib/capa/capa/tests/response_xml_factory.py b/common/lib/capa/capa/tests/response_xml_factory.py index 5bc657d9e4..c88e9d6b09 100644 --- a/common/lib/capa/capa/tests/response_xml_factory.py +++ b/common/lib/capa/capa/tests/response_xml_factory.py @@ -89,7 +89,7 @@ class ResponseXMLFactory(object): # Add input elements for __ in range(int(num_inputs)): input_element = self.create_input_element(**kwargs) - if not None == input_element: + if input_element is not None: response_element.append(input_element) # The problem has an explanation of the solution diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_assetstore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_assetstore.py index b37da813c5..db80dc187a 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_assetstore.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_assetstore.py @@ -4,6 +4,7 @@ too. """ from datetime import datetime, timedelta import ddt +from django.test import TestCase from nose.plugins.attrib import attr import pytz import unittest @@ -84,7 +85,7 @@ class TestSortedAssetList(unittest.TestCase): @attr('mongo') @ddt.ddt -class TestMongoAssetMetadataStorage(unittest.TestCase): +class TestMongoAssetMetadataStorage(TestCase): """ Tests for storing/querying course asset metadata. """ diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo_call_count.py b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo_call_count.py index c89e8d7dc9..548f991952 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo_call_count.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo_call_count.py @@ -5,8 +5,9 @@ when using the Split modulestore. from tempfile import mkdtemp from shutil import rmtree -from unittest import TestCase, skip +from unittest import skip import ddt +from django.test import TestCase from xmodule.modulestore.xml_importer import import_course_from_xml from xmodule.modulestore.xml_exporter import export_course_to_xml diff --git a/common/lib/xmodule/xmodule/tests/__init__.py b/common/lib/xmodule/xmodule/tests/__init__.py index b2a7bf4874..cc94b047f9 100644 --- a/common/lib/xmodule/xmodule/tests/__init__.py +++ b/common/lib/xmodule/xmodule/tests/__init__.py @@ -16,6 +16,7 @@ import traceback import unittest from contextlib import contextmanager, nested +from django.test import TestCase from functools import wraps from mock import Mock from path import Path as path @@ -255,7 +256,7 @@ class _BulkAssertionManager(object): raise BulkAssertionError(self._assertion_errors) -class BulkAssertionTest(unittest.TestCase): +class BulkAssertionTest(TestCase): """ This context manager provides a _BulkAssertionManager to assert with, and then calls `raise_assertion_errors` at the end of the block to validate all diff --git a/docs/testing.rst b/docs/testing.rst index 918dac1e1a..731d84614b 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -693,7 +693,7 @@ To view test coverage: Python Code Style Quality ------------------------- -To view Python code style quality (including pep8 and pylint violations) run this command:: +To view Python code style quality (including PEP 8 and pylint violations) run this command:: paver run_quality diff --git a/lms/djangoapps/courseware/features/lti.py b/lms/djangoapps/courseware/features/lti.py index b761cf0c51..282039354f 100644 --- a/lms/djangoapps/courseware/features/lti.py +++ b/lms/djangoapps/courseware/features/lti.py @@ -118,11 +118,6 @@ def add_correct_lti_to_course(_step, fields): metadata=metadata, ) - world.scenario_dict['LTI'].TEST_BASE_PATH = '{host}:{port}'.format( - host=world.browser.host, - port=world.browser.port, - ) - visit_scenario_item('LTI') diff --git a/pavelib/paver_tests/utils.py b/pavelib/paver_tests/utils.py index 0d0e271aed..2dbcd70cfb 100644 --- a/pavelib/paver_tests/utils.py +++ b/pavelib/paver_tests/utils.py @@ -91,7 +91,7 @@ def fail_on_pylint(*args): def fail_on_npm_install(*args): """ - For our tests, we need the call for diff-quality running pep8 reports to fail, since that is what + For our tests, we need the call for diff-quality running pycodestyle reports to fail, since that is what is going to fail when we pass in a percentage ("p") requirement. """ if "npm install" in args[0]: @@ -102,7 +102,7 @@ def fail_on_npm_install(*args): def unexpected_fail_on_npm_install(*args): """ - For our tests, we need the call for diff-quality running pep8 reports to fail, since that is what + For our tests, we need the call for diff-quality running pycodestyle reports to fail, since that is what is going to fail when we pass in a percentage ("p") requirement. """ if "npm install" in args[0]: diff --git a/pavelib/quality.py b/pavelib/quality.py index 585abfaf98..e717ffcf16 100644 --- a/pavelib/quality.py +++ b/pavelib/quality.py @@ -1,7 +1,7 @@ # coding=utf-8 """ -Check code quality using pep8, pylint, and diff_quality. +Check code quality using pycodestyle, pylint, and diff_quality. """ import json import os @@ -206,8 +206,8 @@ def _count_pylint_violations(report_file): def _get_pep8_violations(clean=True): """ - Runs pep8. Returns a tuple of (number_of_violations, violations_string) - where violations_string is a string of all pep8 violations found, separated + Runs pycodestyle. Returns a tuple of (number_of_violations, violations_string) + where violations_string is a string of all PEP 8 violations found, separated by new lines. """ report_dir = (Env.REPORT_DIR / 'pep8') @@ -220,16 +220,16 @@ def _get_pep8_violations(clean=True): Env.METRICS_DIR.makedirs_p() if not report.exists(): - sh('pep8 . | tee {} -a'.format(report)) + sh('pycodestyle . | tee {} -a'.format(report)) violations_list = _pep8_violations(report) - return (len(violations_list), violations_list) + return len(violations_list), violations_list def _pep8_violations(report_file): """ - Returns the list of all pep8 violations in the given report_file. + Returns the list of all PEP 8 violations in the given report_file. """ with open(report_file) as f: return f.readlines() @@ -243,14 +243,14 @@ def _pep8_violations(report_file): @timed def run_pep8(options): # pylint: disable=unused-argument """ - Run pep8 on system code. + Run pycodestyle on system code. Fail the task if any violations are found. """ (count, violations_list) = _get_pep8_violations() violations_list = ''.join(violations_list) # Print number of violations to log - violations_count_str = "Number of pep8 violations: {count}".format(count=count) + violations_count_str = "Number of PEP 8 violations: {count}".format(count=count) print violations_count_str print violations_list @@ -261,7 +261,7 @@ def run_pep8(options): # pylint: disable=unused-argument # Fail if any violations are found if count: - failure_string = "FAILURE: Too many pep8 violations. " + violations_count_str + failure_string = "FAILURE: Too many PEP 8 violations. " + violations_count_str failure_string += "\n\nViolations:\n{violations_list}".format(violations_list=violations_list) raise BuildFailure(failure_string) diff --git a/requirements/edx/base.in b/requirements/edx/base.in index 451db7068e..dc3dab82b7 100644 --- a/requirements/edx/base.in +++ b/requirements/edx/base.in @@ -24,7 +24,7 @@ # as development.in or testing.in instead. analytics-python==1.1.0 # Used for Segment analytics -attrs==17.2.0 # Reduces boilerplate code involving class attributes +attrs # Reduces boilerplate code involving class attributes Babel==1.3 # Internationalization utilities, used for date formatting in a few places bleach==1.4 # Allowed-list-based HTML sanitizing library that escapes or strips markup and attributes; used for capa and LTI boto==2.39.0 # Deprecated version of the AWS SDK; we should stop using this @@ -63,7 +63,7 @@ django-waffle==0.12.0 django-webpack-loader==0.4.1 djangorestframework-jwt dogapi==1.2.1 # Python bindings to Datadog's API, for metrics gathering -edx-ace +edx-ace==0.1.6 edx-analytics-data-api-client edx-ccx-keys edx-celeryutils @@ -121,7 +121,7 @@ pynliner==0.5.2 # Inlines CSS styles into HTML for email not python-dateutil==2.4 python-Levenshtein python-openid -python-saml +python-saml==2.4.0 pyuca==1.1 # For more accurate sorting of translated country names in django-countries reportlab==3.1.44 # Used for shopping cart's pdf invoice/receipt generation social-auth-app-django==1.2.0 diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index f3f97ace92..1e683d64ac 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -49,7 +49,7 @@ appdirs==1.4.3 # via fs argh==0.26.2 argparse==1.4.0 asn1crypto==0.24.0 -attrs==17.2.0 +attrs==17.4.0 babel==1.3 beautifulsoup==3.2.1 # via pynliner billiard==3.3.0.23 # via celery @@ -70,7 +70,7 @@ django-appconf==1.0.2 # via django-statici18n django-babel-underscore==0.5.2 django-babel==0.6.2 # via django-babel-underscore django-birdcage==1.0.0 -django-braces==1.12.0 # via django-oauth-toolkit +django-braces==1.13.0 # via django-oauth-toolkit django-classy-tags==0.8.0 # via django-sekizai django-config-models==0.1.8 django-cors-headers==2.1.0 @@ -211,7 +211,7 @@ sailthru-client==2.2.3 scipy==0.14.0 shapely==1.2.16 shortuuid==0.5.0 # via edx-django-oauth2-provider -simplejson==3.13.2 # via dogapi, mailsnake, sailthru-client, zendesk +simplejson==3.14.0 # via dogapi, mailsnake, sailthru-client, zendesk six==1.11.0 slumber==0.7.1 # via edx-rest-api-client social-auth-app-django==1.2.0 diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index 7fbc6f2be8..3bbd98555a 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -55,12 +55,12 @@ argh==0.26.2 argparse==1.4.0 asn1crypto==0.24.0 astroid==1.5.2 -attrs==17.2.0 +attrs==17.4.0 babel==1.3 backports.functools-lru-cache==1.5 -beautifulsoup4==4.1.3 +beautifulsoup4==4.6.0 beautifulsoup==3.2.1 -before_after==0.1.3 +before-after==1.0.1 billiard==3.3.0.23 bleach==1.4 bok-choy==0.7.2 @@ -77,7 +77,7 @@ configparser==3.5.0 constantly==15.1.0 coverage==4.2 cryptography==2.1.4 -cssselect==0.9.1 +cssselect==1.0.3 cssutils==1.0.2 ddt==0.8.0 decorator==4.3.0 @@ -88,7 +88,7 @@ django-appconf==1.0.2 django-babel-underscore==0.5.2 django-babel==0.6.2 django-birdcage==1.0.0 -django-braces==1.12.0 +django-braces==1.13.0 django-classy-tags==0.8.0 django-config-models==0.1.8 django-cors-headers==2.1.0 @@ -134,9 +134,9 @@ edx-django-oauth2-provider==1.2.5 edx-django-release-util==0.3.1 edx-django-sites-extensions==2.3.1 edx-drf-extensions==1.2.5 -edx-enterprise==0.67.6 +edx-enterprise==0.67.7 edx-i18n-tools==0.4.4 -edx-lint==0.5.4 +edx-lint==0.5.5 edx-milestones==0.1.13 edx-oauth2-provider==1.2.2 edx-opaque-keys[django]==0.4.4 @@ -158,10 +158,14 @@ faker==0.8.13 feedparser==5.1.3 firebase-token-generator==1.3.2 first==2.0.1 +fixtures==3.0.0 +flake8-polyfill==1.0.2 +flake8==3.5.0 flask==0.12.2 -freezegun==0.3.8 +freezegun==0.3.10 fs-s3fs==0.1.8 fs==2.0.18 +funcsigs==1.0.2 future==0.16.0 futures==3.2.0 ; python_version == "2.7" fuzzywuzzy==0.16.0 @@ -179,7 +183,7 @@ inflect==0.2.5 ipaddr==2.1.11 ipaddress==1.0.22 isodate==0.6.0 -isort==4.2.5 +isort==4.3.4 itsdangerous==0.24 jinja2-pluralize==0.3.0 jinja2==2.10 @@ -191,17 +195,19 @@ lazy-object-proxy==1.3.1 lazy==1.1 lepl==5.1.3 libsass==0.10.0 +linecache2==1.0.0 loremipsum==1.0.5 lxml==3.8.0 mailsnake==1.6.2 mako==1.0.2 -mando==0.3.3 +mando==0.6.4 markdown==2.6.11 markey==0.8 markupsafe==1.0 mccabe==0.6.1 mock==1.0.1 mongoengine==0.10.0 +more-itertools==4.1.0 moto==0.3.1 mysql-python==1.2.5 needle==0.5.0 @@ -221,7 +227,6 @@ pathtools==0.1.2 paver==1.3.4 pbr==4.0.2 pdfminer==20140328 -pep8==1.5.7 piexif==1.0.2 pillow==3.4.0 pip-tools==2.0.1 @@ -232,11 +237,13 @@ py2neo==3.1.2 py==1.5.3 pyasn1-modules==0.2.1 pyasn1==0.4.2 +pycodestyle==2.3.1 pycontracts==1.7.1 pycountry==1.20 pycparser==2.18 pycryptodomex==3.4.7 pydispatcher==2.0.5 +pyflakes==1.6.0 pygments==2.2.0 pygraphviz==1.1 pyinotify==0.9.6 @@ -250,30 +257,30 @@ pymongo==2.9.1 pynliner==0.5.2 pyopenssl==17.5.0 pyparsing==2.2.0 -pyquery==1.2.9 +pyquery==1.4.0 pysqlite==2.8.3 pysrt==0.4.7 pytest-attrib==0.1.3 -pytest-catchlog==1.2.2 pytest-cov==2.5.1 pytest-django==3.1.2 pytest-forked==0.2 -pytest-randomly==1.2.1 -pytest-xdist==1.20.0 -pytest==3.1.3 +pytest-randomly==1.2.3 +pytest-xdist==1.22.2 +pytest==3.5.1 python-dateutil==2.4.0 python-levenshtein==0.12.0 python-memcached==1.48 python-mimeparse==1.6.0 python-openid==2.2.5 python-saml==2.4.0 -python-subunit==0.0.16 +python-slugify==1.2.5 +python-subunit==1.3.0 python-swiftclient==3.5.0 pytz==2016.10 pyuca==1.1 pyyaml==3.12 queuelib==1.5.0 -radon==1.3.2 +radon==2.2.0 redis==2.10.6 reportlab==3.1.44 requests-oauthlib==0.6.1 @@ -287,7 +294,7 @@ selenium==3.11.0 service-identity==17.0.0 shapely==1.2.16 shortuuid==0.5.0 -simplejson==3.13.2 +simplejson==3.14.0 singledispatch==3.4.0.3 six==1.11.0 slumber==0.7.1 @@ -297,22 +304,25 @@ social-auth-app-django==1.2.0 social-auth-core==1.4.0 sorl-thumbnail==12.3 sortedcontainers==0.9.2 -sphinx==1.7.2 +sphinx==1.7.4 sphinxcontrib-websupport==1.0.1 # via sphinx -splinter==0.5.4 +splinter==0.7.7 sqlparse==0.2.4 # via django-debug-toolbar stevedore==1.10.0 -sure==1.2.3 +sure==1.4.9 sympy==0.7.1 -testfixtures==4.5.0 -testtools==0.9.34 +testfixtures==6.0.1 +testtools==2.3.0 text-unidecode==1.2 tox-battery==0.5.1 -tox==2.8.2 -transifex-client==0.12.1 +tox==3.0.0 +traceback2==1.4.0 +transifex-client==0.13.2 twisted==16.6.0 typing==3.6.4 # via sphinx unicodecsv==0.14.1 +unidecode==1.0.22 +unittest2==1.1.0 urllib3==1.22 urlobject==2.4.3 user-util==0.1.3 @@ -326,6 +336,6 @@ werkzeug==0.14.1 wrapt==1.10.5 xblock-review==1.1.5 xblock==1.1.1 -xmltodict==0.4.1 +xmltodict==0.11.0 zendesk==1.1.1 zope.interface==4.5.0 diff --git a/requirements/edx/testing.in b/requirements/edx/testing.in index c556c93687..96305c91d9 100644 --- a/requirements/edx/testing.in +++ b/requirements/edx/testing.in @@ -15,44 +15,38 @@ -r base.txt # Core edx-platform production dependencies -r coverage.txt # Utilities for calculating test coverage -beautifulsoup4==4.1.3 # Library for extracting data from HTML and XML files -before_after==0.1.3 # Syntactic sugar for mock, only used in one test case, not Python 3 compatible +beautifulsoup4 # Library for extracting data from HTML and XML files +before_after # Syntactic sugar for mock, only used in one test case, not Python 3 compatible bok-choy # Framework for browser automation tests, based on selenium -cssselect==0.9.1 # Used to extract HTML fragments via CSS selectors in 2 test cases and pyquery -ddt==0.8.0 # Run a test case multiple times with different input; used in many, many of our tests +cssselect # Used to extract HTML fragments via CSS selectors in 2 test cases and pyquery +ddt # Run a test case multiple times with different input; used in many, many of our tests edx-i18n-tools # Commands for developers and translators to extract, compile and validate translations -edx-lint==0.5.4 # pylint extensions for Open edX repositories +edx-lint # pylint extensions for Open edX repositories factory_boy==2.8.1 # Library for creating test fixtures, used in many tests -freezegun==0.3.8 # Allows tests to mock the output of assorted datetime module functions +freezegun # Allows tests to mock the output of assorted datetime module functions httpretty # Library for mocking HTTP requests, used in many tests -isort==4.2.5 # For checking and fixing the order of imports +isort # For checking and fixing the order of imports moto==0.3.1 # Lets tests mock AWS access via the boto library nose # Former test runner, we're still using some utility functions from it pa11ycrawler # Python crawler (using Scrapy) that uses Pa11y to check accessibility of pages as it crawls -pep8==1.5.7 # Checker for compliance with the Python style guide (PEP 8) +pycodestyle # Checker for compliance with the Python style guide (PEP 8) polib # Library for manipulating gettext translation files, used to test paver i18n commands -pylint-django==0.7.2 # via edx-lint -pyquery==1.2.9 # jQuery-like API for retrieving fragments of HTML and XML files in tests +pyquery # jQuery-like API for retrieving fragments of HTML and XML files in tests pysqlite # DB-API 2.0 interface for SQLite 3.x (used as the relational database for most tests) -pytest==3.1.3 # Testing framework +pytest # Testing framework pytest-attrib # Select tests based on attributes -pytest-catchlog # pytest plugin to catch log messages; merged into pytest 3.3.0 pytest-cov # pytest plugin for measuring code coverage pytest-django==3.1.2 # Django support for pytest -pytest-randomly==1.2.1 # pytest plugin to randomly order tests -pytest-xdist==1.20.0 # Parallel execution of tests on multiple CPU cores or hosts -python-subunit==0.0.16 # via lettuce -radon==1.3.2 # Calculates cyclomatic complexity of Python code (code quality utility) +pytest-randomly # pytest plugin to randomly order tests +pytest-xdist # Parallel execution of tests on multiple CPU cores or hosts +radon # Calculates cyclomatic complexity of Python code (code quality utility) selenium # Browser automation library, used for acceptance tests singledispatch # Backport of functools.singledispatch from Python 3.4+, used in tests of XBlock rendering -splinter==0.5.4 # Browser driver used by lettuce -sure==1.2.3 # via lettuce -testfixtures==4.5.0 # Provides a LogCapture utility used by several tests -testtools==0.9.34 # via python-subunit -tox==2.8.2 # virtualenv management for tests +splinter # Browser driver used by lettuce +testfixtures # Provides a LogCapture utility used by several tests +tox # virtualenv management for tests tox-battery # Makes tox aware of requirements file changes -transifex-client==0.12.1 # Command-line interface for the Transifex localization service -xmltodict==0.4.1 # via moto +transifex-client # Command-line interface for the Transifex localization service # Deprecated acceptance testing framework -e git+https://github.com/edx/lettuce.git@31b0dfd865766243e9b563ec65fae9122edf7975#egg=lettuce==0.2.23+edx.1 diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index e3bae8fb26..f19def348d 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -52,12 +52,12 @@ argh==0.26.2 argparse==1.4.0 asn1crypto==0.24.0 astroid==1.5.2 # via edx-lint, pylint, pylint-celery, pylint-plugin-utils -attrs==17.2.0 +attrs==17.4.0 babel==1.3 backports.functools-lru-cache==1.5 # via astroid, pylint -beautifulsoup4==4.1.3 +beautifulsoup4==4.6.0 beautifulsoup==3.2.1 -before_after==0.1.3 +before-after==1.0.1 billiard==3.3.0.23 bleach==1.4 bok-choy==0.7.2 @@ -70,11 +70,11 @@ charade==1.0.3 click-log==0.1.8 # via edx-lint click==6.7 colorama==0.3.9 # via radon -configparser==3.5.0 # via pylint +configparser==3.5.0 # via flake8, pylint constantly==15.1.0 # via twisted coverage==4.2 cryptography==2.1.4 -cssselect==0.9.1 +cssselect==1.0.3 cssutils==1.0.2 ddt==0.8.0 decorator==4.3.0 @@ -85,7 +85,7 @@ django-appconf==1.0.2 django-babel-underscore==0.5.2 django-babel==0.6.2 django-birdcage==1.0.0 -django-braces==1.12.0 +django-braces==1.13.0 django-classy-tags==0.8.0 django-config-models==0.1.8 django-cors-headers==2.1.0 @@ -129,9 +129,9 @@ edx-django-oauth2-provider==1.2.5 edx-django-release-util==0.3.1 edx-django-sites-extensions==2.3.1 edx-drf-extensions==1.2.5 -edx-enterprise==0.67.6 +edx-enterprise==0.67.7 edx-i18n-tools==0.4.4 -edx-lint==0.5.4 +edx-lint==0.5.5 edx-milestones==0.1.13 edx-oauth2-provider==1.2.2 edx-opaque-keys[django]==0.4.4 @@ -151,10 +151,14 @@ factory_boy==2.8.1 faker==0.8.13 # via factory-boy feedparser==5.1.3 firebase-token-generator==1.3.2 +fixtures==3.0.0 # via testtools +flake8-polyfill==1.0.2 # via radon +flake8==3.5.0 # via flake8-polyfill flask==0.12.2 # via moto -freezegun==0.3.8 +freezegun==0.3.10 fs-s3fs==0.1.8 fs==2.0.18 +funcsigs==1.0.2 # via pytest future==0.16.0 futures==3.2.0 ; python_version == "2.7" fuzzywuzzy==0.16.0 @@ -171,7 +175,7 @@ inflect==0.2.5 ipaddr==2.1.11 ipaddress==1.0.22 isodate==0.6.0 -isort==4.2.5 +isort==4.3.4 itsdangerous==0.24 # via flask jinja2-pluralize==0.3.0 jinja2==2.10 @@ -183,17 +187,19 @@ lazy-object-proxy==1.3.1 # via astroid lazy==1.1 lepl==5.1.3 libsass==0.10.0 +linecache2==1.0.0 # via traceback2 loremipsum==1.0.5 lxml==3.8.0 mailsnake==1.6.2 mako==1.0.2 -mando==0.3.3 # via radon +mando==0.6.4 # via radon markdown==2.6.11 markey==0.8 markupsafe==1.0 -mccabe==0.6.1 # via pylint +mccabe==0.6.1 # via flake8, pylint mock==1.0.1 mongoengine==0.10.0 +more-itertools==4.1.0 # via pytest moto==0.3.1 mysql-python==1.2.5 needle==0.5.0 # via bok-choy @@ -212,57 +218,58 @@ pathtools==0.1.2 paver==1.3.4 pbr==4.0.2 pdfminer==20140328 -pep8==1.5.7 piexif==1.0.2 pillow==3.4.0 -pluggy==0.6.0 # via tox +pluggy==0.6.0 # via pytest, tox polib==1.1.0 psutil==1.2.1 py2neo==3.1.2 -py==1.5.3 # via pytest, pytest-catchlog, tox +py==1.5.3 # via pytest, tox pyasn1-modules==0.2.1 # via service-identity pyasn1==0.4.2 # via pyasn1-modules, service-identity +pycodestyle==2.3.1 pycontracts==1.7.1 pycountry==1.20 pycparser==2.18 pycryptodomex==3.4.7 pydispatcher==2.0.5 # via scrapy +pyflakes==1.6.0 # via flake8 pygments==2.2.0 pygraphviz==1.1 pyjwkest==1.3.2 pyjwt==1.5.2 pylint-celery==0.3 # via edx-lint -pylint-django==0.7.2 +pylint-django==0.7.2 # via edx-lint pylint-plugin-utils==0.2.6 # via pylint-celery, pylint-django pylint==1.7.1 # via edx-lint, pylint-celery, pylint-django, pylint-plugin-utils pymongo==2.9.1 pynliner==0.5.2 pyopenssl==17.5.0 # via scrapy, service-identity pyparsing==2.2.0 -pyquery==1.2.9 +pyquery==1.4.0 pysqlite==2.8.3 pysrt==0.4.7 pytest-attrib==0.1.3 -pytest-catchlog==1.2.2 pytest-cov==2.5.1 pytest-django==3.1.2 pytest-forked==0.2 # via pytest-xdist -pytest-randomly==1.2.1 -pytest-xdist==1.20.0 -pytest==3.1.3 +pytest-randomly==1.2.3 +pytest-xdist==1.22.2 +pytest==3.5.1 python-dateutil==2.4.0 python-levenshtein==0.12.0 python-memcached==1.48 python-mimeparse==1.6.0 # via testtools python-openid==2.2.5 python-saml==2.4.0 -python-subunit==0.0.16 +python-slugify==1.2.5 # via transifex-client +python-subunit==1.3.0 python-swiftclient==3.5.0 pytz==2016.10 pyuca==1.1 pyyaml==3.12 queuelib==1.5.0 # via scrapy -radon==1.3.2 +radon==2.2.0 redis==2.10.6 reportlab==3.1.44 requests-oauthlib==0.6.1 @@ -276,7 +283,7 @@ selenium==3.11.0 service-identity==17.0.0 # via scrapy shapely==1.2.16 shortuuid==0.5.0 -simplejson==3.13.2 +simplejson==3.14.0 singledispatch==3.4.0.3 six==1.11.0 slumber==0.7.1 @@ -284,18 +291,21 @@ social-auth-app-django==1.2.0 social-auth-core==1.4.0 sorl-thumbnail==12.3 sortedcontainers==0.9.2 -splinter==0.5.4 +splinter==0.7.7 stevedore==1.10.0 -sure==1.2.3 +sure==1.4.9 sympy==0.7.1 -testfixtures==4.5.0 -testtools==0.9.34 +testfixtures==6.0.1 +testtools==2.3.0 # via fixtures, python-subunit text-unidecode==1.2 # via faker tox-battery==0.5.1 -tox==2.8.2 -transifex-client==0.12.1 +tox==3.0.0 +traceback2==1.4.0 # via testtools, unittest2 +transifex-client==0.13.2 twisted==16.6.0 # via pa11ycrawler, scrapy unicodecsv==0.14.1 +unidecode==1.0.22 # via python-slugify +unittest2==1.1.0 # via testtools urllib3==1.22 urlobject==2.4.3 # via pa11ycrawler user-util==0.1.3 @@ -309,6 +319,6 @@ werkzeug==0.14.1 # via flask wrapt==1.10.5 xblock-review==1.1.5 xblock==1.1.1 -xmltodict==0.4.1 +xmltodict==0.11.0 # via moto zendesk==1.1.1 zope.interface==4.5.0 # via twisted diff --git a/scripts/circle-ci-tests.sh b/scripts/circle-ci-tests.sh index 618dfb5447..4888706534 100755 --- a/scripts/circle-ci-tests.sh +++ b/scripts/circle-ci-tests.sh @@ -51,7 +51,7 @@ else echo "Finding fixme's and storing report..." paver find_fixme > fixme.log || { cat fixme.log; EXIT=1; } - echo "Finding pep8 violations and storing report..." + echo "Finding PEP 8 violations and storing report..." paver run_pep8 > pep8.log || { cat pep8.log; EXIT=1; } echo "Finding pylint violations and storing in report..." diff --git a/scripts/generic-ci-tests.sh b/scripts/generic-ci-tests.sh index 343ed6e383..2785ebb825 100755 --- a/scripts/generic-ci-tests.sh +++ b/scripts/generic-ci-tests.sh @@ -13,7 +13,7 @@ set -e # `TEST_SUITE` defines which kind of test to run. # Possible values are: # -# - "quality": Run the quality (pep8/pylint) checks +# - "quality": Run the quality (pycodestyle/pylint) checks # - "lms-unit": Run the LMS Python unit tests # - "cms-unit": Run the CMS Python unit tests # - "js-unit": Run the JavaScript tests @@ -122,7 +122,7 @@ case "$TEST_SUITE" in 4) echo "Finding fixme's and storing report..." run_paver_quality find_fixme || { EXIT=1; } - echo "Finding pep8 violations and storing report..." + echo "Finding pycodestyle violations and storing report..." run_paver_quality run_pep8 || { EXIT=1; } echo "Finding ESLint violations and storing report..." run_paver_quality run_eslint -l $ESLINT_THRESHOLD || { EXIT=1; } diff --git a/setup.cfg b/setup.cfg index 04ed95e23f..711a3b966d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,10 +12,13 @@ norecursedirs = .* *.egg build conf dist node_modules test_root cms/envs lms/env python_classes = python_files = tests.py test_*.py tests_*.py *_tests.py __init__.py -[pep8] -# error codes: http://pep8.readthedocs.org/en/latest/intro.html#error-codes +[pycodestyle] +# error codes: https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes # E501: line too long # E265: block comment should start with ‘# ‘ +# We ignore this because pep8 used to erroneously lump E266 into it also. +# We should probably fix these now. +# E266: too many leading ‘#’ for block comment # We have lots of comments that look like "##### HEADING #####" which violate # this rule, because they don't have a space after the first #. However, # they're still perfectly reasonable comments, so we disable this rule. @@ -25,7 +28,9 @@ python_files = tests.py test_*.py tests_*.py *_tests.py __init__.py # http://nedbatchelder.com/blog/200711/rethrowing_exceptions_in_python.html # It's a little unusual, but we have good reasons for doing so, so we disable # this rule. -ignore=E501,E265,W602 +# E305,E402,E722,E731,E741,E743,W503: errors and warnings added since pep8/pycodestyle +# 1.5.7 that we haven't cleaned up yet +ignore=E265,E266,E305,E402,E501,E722,E731,E741,E743,W503,W602 exclude=migrations,.git,.pycharm_helpers,.tox,test_root/staticfiles,node_modules [isort] diff --git a/tox.ini b/tox.ini index 9e05e21bdd..aa0717a7ef 100644 --- a/tox.ini +++ b/tox.ini @@ -48,7 +48,7 @@ deps = django19: Django>=1.9,<1.10 django110: Django>=1.10,<1.11 django111: Django>=1.11,<2 - -rrequirements/edx/testing.txt + -r requirements/edx/testing.txt whitelist_externals = /bin/bash /usr/bin/curl