for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
from time import strftime, localtime
try:
from urlparse import urlparse
from StringIO import StringIO
except ImportError: # python3
from urllib.parse import urlparse
from io.StringIO import StringIO
io.StringIO
This can be caused by one of the following:
This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.
# .scrutinizer.yml before_commands: - sudo pip install abc # Python2 - sudo pip3 install abc # Python3
This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.
__init__.py
from spike import create_app
from spike.model import db
import unittest
class FlaskrTestCase(unittest.TestCase):
def setUp(self):
app = create_app()
db.init_app(app)
app.config['TESTING'] = True
self.app = app.test_client()
def tearDown(self):
pass
def test_robotstxt(self):
assert self.app.get('/robots.txt').data == 'User-agent: *\n Disallow: /'
def test_redirect_root(self):
rv = self.app.get('/', follow_redirects=False)
rv
[a-z_][a-z0-9_]{2,30}$
This check looks for invalid names for a range of different identifiers.
You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.
If your project includes a Pylint configuration file, the settings contained in that file take precedence.
To find out more about Pylint, please refer to their site.
self.assertEqual(rv.status_code, 302)
self.assertEqual(urlparse(rv.location).path, '/rules')
def test_download_db(self):
with open('./spike/rules.db', 'rb') as f:
f
expected = StringIO(f.read())
expected.seek(0)
rv = self.app.get('/download')
assert rv.data == expected.read()