Skip to content

Commit

Permalink
added pyflakes tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ojii committed Nov 4, 2015
1 parent 9c77343 commit 00056c6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/py/gettextjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
VERSION = pkg_resources.get_distribution('gettextjs').version
except pkg_resources.DistributionNotFound:
VERSION = 'dev'

USAGE = """gettextjs
Usage:
Expand Down
22 changes: 20 additions & 2 deletions src/py/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@
import tempfile
import unittest
import shutil
import io

from flask import Flask
import gettextjs
from nose.tools import nottest
from pyflakes import api
from pyflakes.reporter import Reporter
from slimit import ast
from viceroy.api import build_test_case
from viceroy.constants import VICEROY_JS_PATH, VICEROY_STATIC_ROOT
from viceroy.constants import VICEROY_STATIC_ROOT
from viceroy.contrib.flask import ViceroyFlaskTestCase
from viceroy.contrib.qunit import QUnitScanner

import gettextjs



class FixedQUnitScanner(QUnitScanner):
def visit_FunctionCall(self, node):
Expand Down Expand Up @@ -189,6 +195,18 @@ def test_compile_to_js(self):
})


class CodeQualityTests(unittest.TestCase):
def test_pyflakes(self):
files = map(
lambda name: os.path.join(os.path.dirname(__file__), name),
['gettextjs.py', 'tests.py']
)
out = io.StringIO()
reporter = Reporter(out, out)
errors = sum(map(lambda f: api.checkPath(f, reporter), files))
self.assertEqual(errors, 0, '\n' + out.getvalue())


class JSTestsBase(ViceroyFlaskTestCase):
viceroy_flask_app = app

Expand Down
1 change: 1 addition & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ flask-testing
viceroy
docopt
nose
pyflakes

0 comments on commit 00056c6

Please sign in to comment.