diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b9be7ba..e621b7f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,3 +7,8 @@ django19: script: - tox -e py27-django19 + +pep8: + script: + - tox -e pep8 + allow_failure: true diff --git a/src/postorius/management/commands/mmclient.py b/src/postorius/management/commands/mmclient.py index 5e7c685..69b24ac 100644 --- a/src/postorius/management/commands/mmclient.py +++ b/src/postorius/management/commands/mmclient.py @@ -30,7 +30,7 @@ foo.members [] -A complete list of commands can be found in the mailman.client documentation.""" +A complete list of commands can be found in the mailmanclient documentation.""" def handle(self, *args, **options): # choose an interpreter diff --git a/src/postorius/tests/mailman_api_tests/test_address_activation.py b/src/postorius/tests/mailman_api_tests/test_address_activation.py index 15552cb..f276bfb 100644 --- a/src/postorius/tests/mailman_api_tests/test_address_activation.py +++ b/src/postorius/tests/mailman_api_tests/test_address_activation.py @@ -55,25 +55,23 @@ self.mm_user.delete() def test_valid_email_is_valid(self): - form = AddressActivationForm({'email': 'very_new_email@example.org',}) + form = AddressActivationForm({'email': 'very_new_email@example.org'}) self.assertTrue(form.is_valid()) def test_email_used_by_django_auth_is_invalid(self): - # No need for cassette because we should check mailman last since it's the most expensive - form = AddressActivationForm({'email': 'les@example.org',}) + form = AddressActivationForm({'email': 'les@example.org'}) self.assertFalse(form.is_valid()) def test_invalid_email_is_not_valid(self): - # No need for cassette because we should check mailman last since it's the most expensive - form = AddressActivationForm({'email': 'les@example',}) + form = AddressActivationForm({'email': 'les@example'}) self.assertFalse(form.is_valid()) def test_email_used_by_expired_confirmation_profile_is_valid(self): - form = AddressActivationForm({'email': 'expired@example.org',}) + form = AddressActivationForm({'email': 'expired@example.org'}) self.assertTrue(form.is_valid()) def test_email_used_by_mailman_is_invalid(self): - form = AddressActivationForm({'email': 'subscribed@example.org',}) + form = AddressActivationForm({'email': 'subscribed@example.org'}) self.assertFalse(form.is_valid()) diff --git a/src/postorius/tests/mailman_api_tests/test_list_header_matches.py b/src/postorius/tests/mailman_api_tests/test_list_header_matches.py index 749ffbd..bb6e542 100644 --- a/src/postorius/tests/mailman_api_tests/test_list_header_matches.py +++ b/src/postorius/tests/mailman_api_tests/test_list_header_matches.py @@ -139,9 +139,6 @@ } response = self.client.post(url, data) self.assertRedirects(response, url) - #from postorius.tests.utils import get_flash_messages - #msgs = get_flash_messages(response) - #print([m.message for m in msgs]) self.assertHasNoMessage(response) self.assertEqual(len(self.mlist.header_matches), 0) diff --git a/src/postorius/tests/utils.py b/src/postorius/tests/utils.py index d00ed34..6de3dcf 100644 --- a/src/postorius/tests/utils.py +++ b/src/postorius/tests/utils.py @@ -110,7 +110,6 @@ self.mm_client = get_client() if self.use_vcr: cm = MM_VCR.use_cassette('.'.join([ - #self.__class__.__module__.rpartition('.')[2], self.__class__.__name__, self._testMethodName, 'yaml'])) self.cassette = cm.__enter__() self.addCleanup(cm.__exit__, None, None, None) diff --git a/tox.ini b/tox.ini index 30e8c52..d555df9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27-django{18,19} +envlist = py27-django{18,19},pep8 [base] deps = @@ -43,8 +43,8 @@ setenv = PYTHONPATH = {toxinidir} commands = - # Install mailman.client from local repo instead of from pypi - pip install -e ../mailman.client + # Install mailmanclient from local repo instead of from pypi + pip install -e ../mailmanclient django-admin.py test --settings=testing.test_settings {posargs:postorius} [testenv:dev-record] @@ -57,6 +57,19 @@ PYTHONPATH = {toxinidir} POSTORIUS_VCR_RECORD_MODE = all commands = - # Install mailman.client from local repo instead of from pypi - pip install -e ../mailman.client + # Install mailmanclient from local repo instead of from pypi + pip install -e ../mailmanclient django-admin.py test --settings=testing.test_settings {posargs:postorius} + +[testenv:pep8] +basepython = python2.7 +deps = + {[base]deps} + flake8 +commands = + flake8 {posargs} + +[flake8] +ignore = +show-source = True +exclude = .git,.tox,dist,*egg,testing,src/postorius/doc