Skip to content

Commit

Permalink
Upgraded to flake8 for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
palewire committed Oct 30, 2016
1 parent db3d3b2 commit f6ea89a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ install:
- pip install -q Django==$DJANGO_VERSION

script:
- pep8 postgres_copy
- pyflakes postgres_copy
- flake8 postgres_copy
- coverage run setup.py test

after_success:
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@

test:
clear;
flake8 postgres_copy;
coverage run setup.py test;
coverage report -m;
coverage report -m;
12 changes: 8 additions & 4 deletions postgres_copy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ def __init__(
else:
self.static_mapping = {}

# Make sure all of the headers in the mapping actually exist in the CSV file
# Make sure all of the headers in the mapping actually exist
# in the CSV file
headers = self.get_headers()
for map_header in self.mapping.values():
if map_header not in headers:
raise ValueError("Header '%s' in the mapping not found in the CSV file" % map_header)
raise ValueError(
"Header '%s' in mapping not found in CSV file" % map_header
)

# Connect the headers from the CSV with the fields on the model
self.field_header_crosswalk = []
Expand All @@ -59,8 +62,9 @@ def __init__(
try:
f_name = inverse_mapping[h]
except KeyError:
# If the CSV field is not included on the model map, that's okay, it just means
# the user has decided not to load that column.
# If the CSV field is not included on the model map,
# that's okay, it just means the user has decided not
# to load that column.
self.excluded_headers.append(h)
pass
try:
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Django
coverage
pep8
flake8
psycopg2
pyflakes
tox
python-coveralls
sphinx
Expand Down

0 comments on commit f6ea89a

Please sign in to comment.