Make flake8 part of test suite
This commit is contained in:
parent
6292bda8aa
commit
92817d5f4d
@ -6,3 +6,4 @@ python:
|
|||||||
- '2.6'
|
- '2.6'
|
||||||
script:
|
script:
|
||||||
- python setup.py test
|
- python setup.py test
|
||||||
|
- flake8 --ignore=E501,E123,E124,E126,E127,E128 dataset test
|
||||||
|
|||||||
@ -8,7 +8,6 @@ from dataset.persistence.util import sqlite_datetime_fix
|
|||||||
from dataset.persistence.database import Database
|
from dataset.persistence.database import Database
|
||||||
from dataset.persistence.table import Table
|
from dataset.persistence.table import Table
|
||||||
from dataset.freeze.app import freeze
|
from dataset.freeze.app import freeze
|
||||||
from sqlalchemy import Integer, Text
|
|
||||||
|
|
||||||
__all__ = ['Database', 'Table', 'freeze', 'connect']
|
__all__ = ['Database', 'Table', 'freeze', 'connect']
|
||||||
|
|
||||||
|
|||||||
@ -86,4 +86,3 @@ class Export(object):
|
|||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
return self.get('name', self.get('query'))
|
return self.get('name', self.get('query'))
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import os
|
import os
|
||||||
import logging
|
|
||||||
import re
|
import re
|
||||||
import locale
|
import locale
|
||||||
|
|
||||||
@ -69,8 +68,7 @@ class Serializer(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def wrap(self):
|
def wrap(self):
|
||||||
return self.export.get_bool('wrap',
|
return self.export.get_bool('wrap', default=self.mode == 'list')
|
||||||
default=self.mode=='list')
|
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
self.init()
|
self.init()
|
||||||
|
|||||||
@ -21,4 +21,3 @@ class TabsonSerializer(JSONSerializer):
|
|||||||
if meta is not None:
|
if meta is not None:
|
||||||
result['meta'] = meta
|
result['meta'] = meta
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
@ -11,9 +11,9 @@ except ImportError:
|
|||||||
|
|
||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
from sqlalchemy.pool import NullPool
|
from sqlalchemy.pool import NullPool
|
||||||
from sqlalchemy.schema import MetaData, Column, Index
|
from sqlalchemy.schema import MetaData, Column
|
||||||
from sqlalchemy.schema import Table as SQLATable
|
from sqlalchemy.schema import Table as SQLATable
|
||||||
from sqlalchemy import Integer, Text, String
|
from sqlalchemy import Integer, String
|
||||||
|
|
||||||
from alembic.migration import MigrationContext
|
from alembic.migration import MigrationContext
|
||||||
from alembic.operations import Operations
|
from alembic.operations import Operations
|
||||||
@ -107,10 +107,8 @@ class Database(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def tables(self):
|
def tables(self):
|
||||||
""" Get a listing of all tables that exist in the database.
|
"""
|
||||||
|
Get a listing of all tables that exist in the database.
|
||||||
>>> print db.tables
|
|
||||||
set([u'user', u'action'])
|
|
||||||
"""
|
"""
|
||||||
return list(
|
return list(
|
||||||
set(self.metadata.tables.keys()) | set(self._tables.keys())
|
set(self.metadata.tables.keys()) | set(self._tables.keys())
|
||||||
|
|||||||
@ -24,9 +24,6 @@ class Table(object):
|
|||||||
def columns(self):
|
def columns(self):
|
||||||
"""
|
"""
|
||||||
Get a listing of all columns that exist in the table.
|
Get a listing of all columns that exist in the table.
|
||||||
|
|
||||||
>>> print 'age' in table.columns
|
|
||||||
True
|
|
||||||
"""
|
"""
|
||||||
return set(self.table.columns.keys())
|
return set(self.table.columns.keys())
|
||||||
|
|
||||||
@ -101,7 +98,6 @@ class Table(object):
|
|||||||
if chunk:
|
if chunk:
|
||||||
_process_chunk(chunk)
|
_process_chunk(chunk)
|
||||||
|
|
||||||
|
|
||||||
def update(self, row, keys, ensure=True, types={}):
|
def update(self, row, keys, ensure=True, types={}):
|
||||||
"""
|
"""
|
||||||
Update a row in the table. The update is managed via
|
Update a row in the table. The update is managed via
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
#coding: utf-8
|
#coding: utf-8
|
||||||
import re
|
import re
|
||||||
from unicodedata import normalize as ucnorm, category
|
|
||||||
|
|
||||||
SLUG_REMOVE = re.compile(r'[,\s\.\(\)/\\;:]*')
|
SLUG_REMOVE = re.compile(r'[,\s\.\(\)/\\;:]*')
|
||||||
|
|
||||||
|
|
||||||
class DatasetException(Exception):
|
class DatasetException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class FreezeException(DatasetException):
|
class FreezeException(DatasetException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
2
setup.py
2
setup.py
@ -35,7 +35,7 @@ setup(
|
|||||||
'python-slugify >= 0.0.6',
|
'python-slugify >= 0.0.6',
|
||||||
"PyYAML >= 3.10"
|
"PyYAML >= 3.10"
|
||||||
] + py26_dependency,
|
] + py26_dependency,
|
||||||
tests_require=[],
|
tests_require=['flake8'],
|
||||||
test_suite='test',
|
test_suite='test',
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
|
|||||||
@ -8,7 +8,6 @@ from dataset import connect
|
|||||||
from dataset.util import DatasetException
|
from dataset.util import DatasetException
|
||||||
|
|
||||||
from .sample_data import TEST_DATA, TEST_CITY_1
|
from .sample_data import TEST_DATA, TEST_CITY_1
|
||||||
from sqlalchemy.exc import IntegrityError
|
|
||||||
|
|
||||||
|
|
||||||
class DatabaseTestCase(unittest.TestCase):
|
class DatabaseTestCase(unittest.TestCase):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user