Commits

Tomohiro Nakamura  committed 856637c

tox対応

- 同じ名前のモジュール名だとエラーが出るので、
共通の場所に切り出して対応した。

  • Participants
  • Parent commits 83e8eec

Comments (0)

Files changed (5)

 eggs
 parts
 src/.*.egg-info
+.tox
+junit-py25.xml
+junit-py26.xml
+junit-py27.xml

File src/nwdiag/tests/test_pep8.py

-# -*- coding: utf-8 -*-
-
-import os
-import pep8
-
-CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
-BASE_DIR = os.path.dirname(CURRENT_DIR)
-
-
-def test_pep8():
-    arglist = [
-        '--statistics',
-        '--filename=*.py',
-        '--show-source',
-        '--repeat',
-        '--exclude=SVGdraw.py',
-        #'--show-pep8',
-        #'-qq',
-        #'-v',
-        BASE_DIR,
-    ]
-
-    options, args = pep8.process_options(arglist)
-    runner = pep8.input_file
-
-    for path in args:
-        if os.path.isdir(path):
-            pep8.input_dir(path, runner=runner)
-        elif not pep8.excluded(path):
-            options.counters['files'] += 1
-            runner(path)
-
-    pep8.print_statistics()
-    errors = pep8.get_count('E')
-    warnings = pep8.get_count('W')
-    message = 'pep8: %d errors / %d warnings' % (errors, warnings)
-    print message
-    assert errors + warnings == 0, message

File src/rackdiag/tests/test_pep8.py

-# -*- coding: utf-8 -*-
-
-import os
-import pep8
-
-CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
-BASE_DIR = os.path.dirname(CURRENT_DIR)
-
-
-def test_pep8():
-    arglist = [
-        '--statistics',
-        '--filename=*.py',
-        '--show-source',
-        '--repeat',
-        '--exclude=SVGdraw.py',
-        #'--show-pep8',
-        #'-qq',
-        #'-v',
-        BASE_DIR,
-    ]
-
-    options, args = pep8.process_options(arglist)
-    runner = pep8.input_file
-
-    for path in args:
-        if os.path.isdir(path):
-            pep8.input_dir(path, runner=runner)
-        elif not pep8.excluded(path):
-            options.counters['files'] += 1
-            runner(path)
-
-    pep8.print_statistics()
-    errors = pep8.get_count('E')
-    warnings = pep8.get_count('W')
-    message = 'pep8: %d errors / %d warnings' % (errors, warnings)
-    print message
-    assert errors + warnings == 0, message

File test/test_pep8.py

+# -*- coding: utf-8 -*-
+
+from os.path import abspath, dirname, join, isdir
+import pep8
+
+# テスト対象のディレクトリ
+BASE_DIR = join(dirname(dirname(abspath(__file__))), 'src')
+
+def test_pep8():
+    arglist = [
+        '--statistics',
+        '--filename=*.py',
+        '--show-source',
+        '--repeat',
+        '--exclude=SVGdraw.py',
+        #'--show-pep8',
+        #'-qq',
+        #'-v',
+        BASE_DIR,
+    ]
+
+    options, args = pep8.process_options(arglist)
+    runner = pep8.input_file
+
+    for path in args:
+        if isdir(path):
+            pep8.input_dir(path, runner=runner)
+        elif not pep8.excluded(path):
+            options.counters['files'] += 1
+            runner(path)
+
+    pep8.print_statistics()
+    errors = pep8.get_count('E')
+    warnings = pep8.get_count('W')
+    message = 'pep8: %d errors / %d warnings' % (errors, warnings)
+    print message
+    assert errors + warnings == 0, message
+[tox]
+envlist = py25, py26, py27
+
+[testenv:py25]
+basepython = /usr/bin/python2.5
+
+[testenv:py26]
+basepython = /usr/bin/python2.6
+
+[testenv:py27]
+basepython = /usr/bin/python2.7
+
+[testenv]
+deps = 
+  pep8
+  pytest
+  pytest-cov
+  setuptools
+  blockdiag>=1.1.0
+  Nose
+  unittest2
+
+commands =
+  py.test \
+    --cov-report term-missing \
+    --cov nwdiag \
+    --junitxml=junit-{envname}.xml