Closed Bug 1406388 Opened 7 years ago Closed 7 years ago

Run flake8 as automated test

Categories

(Localization Infrastructure and Tools :: compare-locales, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Pike, Assigned: Pike)

Details

Attachments

(1 file, 1 obsolete file)

We should add flake8 to our automated test suite.
Comment on attachment 8915984 [details]
bug 1406388, run flake on travis,

https://reviewboard.mozilla.org/r/187270/#review192310

I don't know Travis well enough to verify that this is the magic incantation requried to make flake8 run. I trust that you know better :)

I also have doubts if this is a good idea, in principle. Unless we run the same flake8 test before pushing to the hg.mozilla.org fork (e.g. as part of the mozreview process, somehow), there's a risk of pushing something which doesn't flake8 and then the git build breaks. Perhaps some sort of a pre-push hook in hg could do the trick?

Rubber-stamp r=me.
Attachment #8915984 - Flags: review?(stas) → review+
It looks like this broke tox for me:

flake8 create: /home/stas/moz/compare-locales/.tox/flake8
flake8 installdeps: flake8
flake8 inst: /home/stas/moz/compare-locales/.tox/dist/compare-locales-2.1.zip
flake8 installed: compare-locales==2.1,flake8==3.4.1,fluent==0.4.2,mccabe==0.6.1,pkg-resources==0.0.0,pycodestyle==2.3.1,pyflakes==1.5.0,pytoml==0.1.14
flake8 runtests: commands[0] | flake8 compare_locales
compare_locales/parser.py:216:38: E999 SyntaxError: invalid syntax
compare_locales/paths.py:248:37: F821 undefined name 'basestring'
compare_locales/paths.py:253:40: F821 undefined name 'basestring'
compare_locales/paths.py:469:34: F821 undefined name 'basestring'
compare_locales/paths.py:558:13: F821 undefined name 'execfile'
compare_locales/paths.py:700:14: F821 undefined name 'cmp'
compare_locales/paths.py:703:16: F821 undefined name 'cmp'
compare_locales/merge.py:62:16: F821 undefined name 'reduce'
compare_locales/merge.py:113:14: F821 undefined name 'reduce'
compare_locales/checks.py:112:31: E999 SyntaxError: invalid syntax
compare_locales/compare.py:366:40: E999 SyntaxError: invalid syntax
compare_locales/commands.py:147:34: E999 SyntaxError: invalid syntax
compare_locales/tests/test_checks.py:311:33: E999 SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 12-16: truncated \uXXXX escape
compare_locales/tests/__init__.py:43:66: F821 undefined name 'unicode'
compare_locales/tests/__init__.py:44:60: F821 undefined name 'unicode'
ERROR: InvocationError: '/home/stas/moz/compare-locales/.tox/flake8/bin/flake8 compare_locales'


(I needed to locally edit setup.py to specify fluent==0.4.2 in order to test this across multiple changesets.)
Attachment #8915984 - Attachment is obsolete: true
I verified that that's a symptom from running flake8 in python3, so this patch forces us to use python2.7.

Stas, can you try that?

(The tests fail right now because of fluent 0.4.3 is out)
Comment on attachment 8916557 [details]
bug 1406388, fixup flake8 environment to force python2.7,

https://reviewboard.mozilla.org/r/187702/#review192670

Thanks, this fixed the issue I was having.
Attachment #8916557 - Flags: review?(stas) → review+
https://hg.mozilla.org/l10n/compare-locales/rev/f84178ef9b93012d7ca1e3660a1e3237cedae266, marking FIXED.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: