Add a test to the scaffold project buildout that ensures pep8 passes.

This commit is contained in:
Ryan Petrello
2013-01-08 11:08:56 -05:00
parent 3843ccbfc1
commit f478bd59c5
2 changed files with 35 additions and 1 deletions

View File

@@ -12,7 +12,10 @@ class TestRootController(FunctionalTest):
def test_search(self):
response = self.app.post('/', params={'q': 'RestController'})
assert response.status_int == 302
assert response.headers['Location'] == 'http://pecan.readthedocs.org/en/latest/search.html?q=RestController'
assert response.headers['Location'] == (
'http://pecan.readthedocs.org/en/latest/search.html'
'?q=RestController'
)
def test_get_not_found(self):
response = self.app.get('/a/bogus/url', expect_errors=True)

View File

@@ -322,3 +322,34 @@ class TestTemplateBuilds(unittest.TestCase):
proc.wait()
assert proc.stderr.read().splitlines()[-1].strip() == 'OK'
@unittest.skipUnless(has_internet(), 'Internet connectivity unavailable.')
@unittest.skipUnless(
getattr(pecan, '__run_all_tests__', False) is True,
'Skipping (slow). To run, `$ python setup.py test --functional.`'
)
def test_project_passes_pep8(self):
# Install pep8
pip_exe = os.path.join(self.install_dir, 'bin', 'pip')
proc = subprocess.Popen([
pip_exe,
'install',
'pep8'
])
proc.wait()
# Run pep8 on setup.py and the project
pep8_exe = os.path.join(self.install_dir, 'bin', 'pep8')
proc = subprocess.Popen([
pep8_exe,
'setup.py',
'testing123'
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
proc.wait()
# No output == good
output = proc.stdout.read()
assert output == ''