Merge lp:~joel-pythonica/phatch/pep8 into lp:phatch

Proposed by Joel Pearson
Status: Merged
Merged at revision: not available
Proposed branch: lp:~joel-pythonica/phatch/pep8
Merge into: lp:phatch
Diff against target: 82 lines (+73/-0)
2 files modified
tests/run_pep8_doc_test.py (+40/-0)
tests/run_pep8_test.py (+33/-0)
To merge this branch: bzr merge lp:~joel-pythonica/phatch/pep8
Reviewer Review Type Date Requested Status
Stani Needs Fixing
Review via email: mp+20090@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Joel Pearson (joel-pythonica) wrote :

I've converted both run_pep8_test and run_pep8_doc_test to Python, and they appear to produce the same results as the corresponding shell scripts.

Revision history for this message
Stani (stani) wrote :

Great! For Phatch source code we use LF (\n not \r\n) as line endings otherwise I can't make it run when the file is executable:

$ ./run_pep8_test.py
bash: ./run_pep8_test.py: /usr/bin/python^M: bad interpreter: No such file or directory

I have fixed this now for you, but please change your editor to use LF line endings in the future.

I've updated the blueprint with tasks:
- convert the "...".split() commands to lists to make them more dynamic
- exclude linux tests on windows (-e linux) for nose
- do not exclude windows tests on windows (-e windows) for nose
- let it report the files which are not yet converted to PEP8, if possible with percentage

Please update the blueprint as you progress: put DONE after each subtask as you progress.
Before you continue make sure to merge from trunk first:
bzr merge lp:phatch

As I merged in the new pep8.py many new pep8 errors are reported which need fixing. I am working on them, but feel free to help. I'd like to have the trunk as soon as possible again to be pep8 clean.

Thanks for your work!

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'tests/run_pep8_doc_test.py'
2--- tests/run_pep8_doc_test.py 1970-01-01 00:00:00 +0000
3+++ tests/run_pep8_doc_test.py 2010-02-24 22:20:30 +0000
4@@ -0,0 +1,40 @@
5+#!/usr/bin/python
6+# -*- coding: utf-8 -*-
7+
8+# This program is free software: you can redistribute it and/or modify
9+# it under the terms of the GNU General Public License as published by
10+# the Free Software Foundation, either version 3 of the License, or
11+# (at your option) any later version.
12+#
13+# This program is distributed in the hope that it will be useful,
14+# but WITHOUT ANY WARRANTY; without even the implied warranty of
15+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+# GNU General Public License for more details.
17+#
18+# You should have received a copy of the GNU General Public License
19+# along with this program. If not, see http://www.gnu.org/licenses/
20+#
21+# Follows PEP8
22+
23+import os
24+import subprocess
25+
26+import run_pep8_test
27+
28+TEST_ARGS = """nosetests --with-doctest -e windows --noexe -v
29+ core lib lib/pyWx/*.py lib/linux/*.py""".split()
30+
31+
32+def main():
33+ os.chdir('../phatch')
34+ os.rename('__init__.py', '__init__.py.test')
35+ subprocess.call(TEST_ARGS)
36+ os.rename('__init__.py.test', '__init__.py')
37+ os.chdir('../tests')
38+ run_pep8_test.main()
39+ print
40+ print "For logging type:"
41+ print "./test > test.txt 2>&1"
42+
43+if __name__ == '__main__':
44+ main()
45
46=== added file 'tests/run_pep8_test.py'
47--- tests/run_pep8_test.py 1970-01-01 00:00:00 +0000
48+++ tests/run_pep8_test.py 2010-02-24 22:20:30 +0000
49@@ -0,0 +1,33 @@
50+#!/usr/bin/python
51+# -*- coding: utf-8 -*-
52+
53+# This program is free software: you can redistribute it and/or modify
54+# it under the terms of the GNU General Public License as published by
55+# the Free Software Foundation, either version 3 of the License, or
56+# (at your option) any later version.
57+#
58+# This program is distributed in the hope that it will be useful,
59+# but WITHOUT ANY WARRANTY; without even the implied warranty of
60+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
61+# GNU General Public License for more details.
62+#
63+# You should have received a copy of the GNU General Public License
64+# along with this program. If not, see http://www.gnu.org/licenses/
65+#
66+# Follows PEP8
67+
68+import os
69+import subprocess
70+
71+PEP8_ARGS = 'python test_suite/pep8.py --show-source --repeat'.split()
72+
73+
74+def main(dirname='..'):
75+ for root, dirs, files in os.walk(dirname):
76+ for name in files:
77+ filename = os.path.join(root, name)
78+ if filename.endswith('.py') and 'PEP8' in file(filename).read():
79+ subprocess.call(PEP8_ARGS + [filename])
80+
81+if __name__ == '__main__':
82+ main()

Subscribers

People subscribed via source and target branches

to status/vote changes: