• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

Revision17bd86bafacb56f1b2a67c477a00b4dc7cde30a6 (tree)
Time2012-06-07 23:58:56
Authorbolkimen <bolkimen@yaho...>
Commiterbolkimen

Log Message

ticket:66 add pyflakes

Change Summary

Incremental Difference

--- a/AlluraTesting/alluratest/test_syntax.py
+++ b/AlluraTesting/alluratest/test_syntax.py
@@ -85,11 +85,14 @@ def test_no_tabs():
8585 if run(find_py + " | xargs grep ' ' ") not in [1,123]:
8686 raise Exception('These should not use tab chars')
8787
88-def test_pep8():
88+def code_check(cmd_app, sample_file_name, work_file_name):
8989 samples_dir = pkg_resources.resource_filename(
9090 'alluratest', 'data')
91- pep8_sample_path = os.path.join(samples_dir, 'pep8_sample.txt')
92- pep8_work_path = os.path.join(samples_dir, 'pep8_work.txt')
91+ if not os.path.exists(samples_dir):
92+ os.makedirs(samples_dir)
93+
94+ pep8_sample_path = os.path.join(samples_dir, sample_file_name)
95+ pep8_work_path = os.path.join(samples_dir, work_file_name)
9396
9497 initialize_mode = True
9598 if os.path.isfile(pep8_sample_path):
@@ -112,7 +115,7 @@ def test_pep8():
112115 all_files = [f for f in find_stdout.split('\n')
113116 if '/migrations/' not in f and f.strip()]
114117 for files in grouper(20, all_files, fillvalue=''):
115- cmd = "pep8 " + ' '.join(files)
118+ cmd = cmd_app + " " + ' '.join(files)
116119 retval, stdout, stderr = run_with_output(cmd)
117120
118121 if initialize_mode:
@@ -135,35 +138,12 @@ def test_pep8():
135138 sys.stdout.write("%s\n" % l)
136139 error = True
137140 if error:
138- raise Exception('pep8 failure, see stdout')
141+ raise Exception('%s failure, see stdout' % cmd_app)
139142 else:
140143 shutil.copyfile(pep8_work_path, pep8_sample_path)
141144
142-def test_pylint():
143- # TODO
144- return
145- samples_dir = pkg_resources.resource_filename(
146- 'alluratest', 'tests/data')
147- pep8_sample_path = os.path.join(samples_dir, 'pep8_sample.txt')
148- run_with_output()
149- assert False
150- """
151- proc = Popen(find_py, shell=True, cwd=toplevel_dir, stdout=PIPE, stderr=PIPE)
152- (find_stdout, stderr) = proc.communicate()
153- sys.stderr.write(stderr)
154- assert proc.returncode == 0, proc.returncode
155-
156- error = False
157- all_files = [f for f in find_stdout.split('\n')
158- if '/migrations/' not in f and f.strip()]
159- for files in grouper(20, all_files, fillvalue=''):
160- cmd = "pylint -e " + ' '.join(files)
161- retval = run(cmd)
162- if retval == 1:
163- print
164- #print 'Command was: %s' % cmd
165- print 'Returned %s' % retval
166- error = True
145+def test_pep8():
146+ code_check('pep8', 'pep8_sample.txt', 'pep8_work.txt')
167147
168- assert False
169- """
148+def test_pyflakes():
149+ code_check('pyflakes', 'pyflakes_sample.txt', 'pyflakes_work.txt')