Skip to content

Commit

Permalink
CircleCI: Run some key flake8 tests (#64)
Browse files Browse the repository at this point in the history
These tests find Python syntax errors and undefined names.
  • Loading branch information
cclauss authored and my8100 committed Jul 7, 2019
1 parent 1ea0ab3 commit dfcdc07
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
name: Run tests
command: |
. venv/bin/activate
# flake8 --exclude=venv* --statistics
flake8 . --count --exclude=./venv* --select=E9,F63,F7,F82 --show-source --statistics
coverage erase
coverage run --source=scrapydweb -m pytest tests -s -vv -l --disable-warnings -x
Expand Down
2 changes: 1 addition & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pip>=19.1.1
# flake8
flake8
coverage
pytest
# pytest-cov
Expand Down
3 changes: 2 additions & 1 deletion scrapydweb/views/myview.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from flask import flash, g, request, url_for
from flask.views import View
from logparser import __version__ as LOGPARSER_VERSION
from six import text_type

from ..__version__ import __version__ as SCRAPYDWEB_VERSION
from ..common import (get_now_string, get_response_from_view, handle_metadata,
Expand Down Expand Up @@ -345,7 +346,7 @@ def safe_walk(self, top, topdown=True, onerror=None, followlinks=False):

new_names = []
for name in names:
if isinstance(name, unicode):
if isinstance(name, text_type):
new_names.append(name)
else:
msg = "Ignore non-unicode filename %s in %s" % (repr(name), top)
Expand Down
3 changes: 2 additions & 1 deletion scrapydweb/views/operations/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import zipfile

from flask import flash, redirect, render_template, request, url_for
from six import text_type
from six.moves.configparser import Error as ScrapyCfgParseError
from werkzeug.utils import secure_filename

Expand Down Expand Up @@ -78,7 +79,7 @@ def set_scrapy_cfg_list(self):
except UnicodeDecodeError:
if PY2:
for name in os.listdir(os.path.join(self.SCRAPY_PROJECTS_DIR, u'')):
if not isinstance(name, unicode):
if not isinstance(name, text_type):
msg = "Ignore non-unicode filename %s in %s" % (repr(name), self.SCRAPY_PROJECTS_DIR)
self.logger.error(msg)
flash(msg, self.WARN)
Expand Down

0 comments on commit dfcdc07

Please sign in to comment.