← Back to team overview

phatch-dev team mailing list archive

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

 

Joel Pearson has proposed merging lp:~joel-pythonica/phatch/pep8 into lp:phatch.

    Requested reviews:
    stani (stani)


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.
-- 
https://code.launchpad.net/~joel-pythonica/phatch/pep8/+merge/20090
Your team Phatch Developers is subscribed to branch lp:phatch.
=== added file 'tests/run_pep8_doc_test.py'
--- tests/run_pep8_doc_test.py	1970-01-01 00:00:00 +0000
+++ tests/run_pep8_doc_test.py	2010-02-24 22:20:30 +0000
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see http://www.gnu.org/licenses/
+#
+# Follows PEP8
+
+import os
+import subprocess
+
+import run_pep8_test
+
+TEST_ARGS = """nosetests --with-doctest -e windows --noexe -v
+                         core lib lib/pyWx/*.py lib/linux/*.py""".split()
+
+
+def main():
+    os.chdir('../phatch')
+    os.rename('__init__.py', '__init__.py.test')
+    subprocess.call(TEST_ARGS)
+    os.rename('__init__.py.test', '__init__.py')
+    os.chdir('../tests')
+    run_pep8_test.main()
+    print
+    print "For logging type:"
+    print "./test > test.txt 2>&1"
+
+if __name__ == '__main__':
+    main()

=== added file 'tests/run_pep8_test.py'
--- tests/run_pep8_test.py	1970-01-01 00:00:00 +0000
+++ tests/run_pep8_test.py	2010-02-24 22:20:30 +0000
@@ -0,0 +1,33 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see http://www.gnu.org/licenses/
+#
+# Follows PEP8
+
+import os
+import subprocess
+
+PEP8_ARGS = 'python test_suite/pep8.py --show-source --repeat'.split()
+
+
+def main(dirname='..'):
+    for root, dirs, files in os.walk(dirname):
+        for name in files:
+            filename = os.path.join(root, name)
+            if filename.endswith('.py') and 'PEP8' in file(filename).read():
+                subprocess.call(PEP8_ARGS + [filename])
+
+if __name__ == '__main__':
+    main()


Follow ups