forked from zheller/flake8-quotes
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e88a2f2
commit 9d9bca8
Showing
11 changed files
with
67 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
*.egg | ||
*.egg-info | ||
*.py[cod] | ||
.cache/ | ||
.coverage | ||
.tox | ||
dist | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
language: python | ||
install: | ||
- pip install tox | ||
script: | ||
- tox | ||
python: | ||
- 2.7 | ||
- 3.3 | ||
- 3.4 | ||
script: python setup.py test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,26 +9,46 @@ | |
* `development version | ||
<https://github.com/maxcountryman/flake8-single-quotes>`_ | ||
''' | ||
import sys | ||
|
||
from setuptools import setup | ||
from setuptools import find_packages, setup | ||
from setuptools.command.test import test as TestCommand | ||
|
||
import flake8_single_quotes | ||
|
||
setup_requires = ['pytest', 'tox'] | ||
install_requires = ['setuptools', 'tox'] | ||
tests_requires = ['pytest-cov', 'pytest-cache'] | ||
|
||
|
||
class PyTest(TestCommand): | ||
def finalize_options(self): | ||
TestCommand.finalize_options(self) | ||
self.test_args = ['--strict', | ||
'--verbose', | ||
'--tb=long', | ||
'--cov', 'flake8_single_quotes.py', | ||
'--cov-report', 'term-missing', 'tests'] | ||
self.test_suite = True | ||
|
||
def run_tests(self): | ||
import pytest | ||
errno = pytest.main(self.test_args) | ||
sys.exit(errno) | ||
|
||
|
||
ext_checker_str = 'flake8_single_quotes = flake8_single_quotes:QuoteChecker' | ||
|
||
setup(name='flake8-single-quotes', | ||
author='Max Countryman', | ||
author_email='[email protected]', | ||
version=flake8_single_quotes.__version__, | ||
install_requires=['setuptools'], | ||
url='http://github.com/maxcountryman/flake8-single-quotes/', | ||
long_description=__doc__, | ||
description='A Flake8 extension to enforce single-quotes.', | ||
long_description=__doc__, | ||
py_modules=['flake8_single_quotes'], | ||
test_suite='test', | ||
include_package_data=True, | ||
entry_points={'flake8.extension': [ext_checker_str]}, | ||
packages=find_packages(exclude=['tests']), | ||
classifiers=['Development Status :: 4 - Beta', | ||
'Environment :: Console', | ||
'Intended Audience :: Developers', | ||
|
@@ -37,4 +57,9 @@ | |
'Programming Language :: Python', | ||
'Programming Language :: Python :: 2', | ||
'Topic :: Software Development :: Quality Assurance'], | ||
cmdclass={'test': PyTest}, | ||
setup_requires=setup_requires, | ||
install_requires=install_requires, | ||
tests_require=tests_requires, | ||
extras_require={'test': tests_requires}, | ||
zip_safe=False) |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os | ||
|
||
import flake8_single_quotes as fsq | ||
|
||
|
||
def test_get_noqa_lines(): | ||
with open('tests/data/no_qa.py') as f: | ||
lines = f.readlines() | ||
assert fsq.get_noqa_lines(lines) == [2] | ||
|
||
|
||
def test_wrapped(): | ||
with open('tests/data/wrapped.py') as f: | ||
lines = f.readlines() | ||
assert list(fsq.get_double_quotes_errors(lines)) == [] | ||
|
||
|
||
def test_doubles(): | ||
with open('tests/data/doubles.py') as f: | ||
lines = f.readlines() | ||
expected = [{'col': 24, | ||
'line': 1, | ||
'message': 'Q000 Strings should use single quotes.'}] | ||
assert list(fsq.get_double_quotes_errors(lines)) == expected | ||
|
||
|
||
def test_noqa_doubles(): | ||
abspath = os.path.abspath('tests/data/doubles_noqa.py') | ||
checker = fsq.QuoteChecker(None, abspath) | ||
assert list(checker.run()) == [] |