Add scaffold tests for Python 3.2/3.3.

This commit is contained in:
Ryan Petrello
2013-04-30 21:51:40 -04:00
parent 0eccb084fc
commit 2ed2fe64c3
2 changed files with 36 additions and 7 deletions

View File

@@ -10,6 +10,7 @@ else:
import unittest # noqa
import six
from six import b as b_
if six.PY3:
from urllib.request import urlopen, URLError
else:
@@ -62,7 +63,8 @@ if __name__ == '__main__':
# ...and that it's serving (valid) content...
resp = urlopen('http://localhost:8080/')
assert resp.getcode() == 200
assert 'This is a sample Pecan project.' in resp.read()
assert 'This is a sample Pecan project.' in \
resp.read().decode()
except URLError:
pass
else:
@@ -86,11 +88,11 @@ if __name__ == '__main__':
self.poll(proc)
out, _ = proc.communicate(
'{"model" : model, "conf" : conf, "app" : app}'
b_('{"model" : model, "conf" : conf, "app" : app}')
)
assert 'testing123.model' in out, out
assert 'Config(' in out, out
assert 'webtest.app.TestApp' in out, out
assert 'testing123.model' in out.decode(), out
assert 'Config(' in out.decode(), out
assert 'webtest.app.TestApp' in out.decode(), out
try:
# just in case stdin doesn't close
@@ -115,7 +117,8 @@ if __name__ == '__main__':
# ...and that it's serving (valid) content...
resp = urlopen('http://localhost:%d/' % port)
assert resp.getcode() == 200
assert 'This is a sample Pecan project.' in resp.read()
assert 'This is a sample Pecan project.' in \
resp.read().decode()
except URLError:
pass
else:

28
tox.ini
View File

@@ -1,5 +1,5 @@
[tox]
envlist = py26,py27,py32,py33,scaffolds-26,scaffolds-27,pep8
envlist = py26,py27,py32,py33,scaffolds-26,scaffolds-27,scaffolds-32,scaffolds-33,pep8
[testenv]
commands={envpython} setup.py test -v
@@ -26,6 +26,32 @@ commands=pecan create testing123
pep8 --repeat --show-source testing123/setup.py testing123/testing123
{envpython} {toxinidir}/pecan/tests/scaffold_builder.py
[testenv:scaffolds-32]
basepython = python3.2
deps = pep8
gunicorn
changedir={[testenv:scaffolds-26]changedir}
commands=pecan create testing123
curl "http://python-distribute.org/distribute_setup.py" -O
{envpython} distribute_setup.py
{envpython} testing123/setup.py install
{envpython} testing123/setup.py test -q
pep8 --repeat --show-source testing123/setup.py testing123/testing123
{envpython} {toxinidir}/pecan/tests/scaffold_builder.py
[testenv:scaffolds-33]
basepython = python3.3
deps = pep8
gunicorn
changedir={[testenv:scaffolds-26]changedir}
commands=pecan create testing123
curl "http://python-distribute.org/distribute_setup.py" -O
{envpython} distribute_setup.py
{envpython} testing123/setup.py install
{envpython} testing123/setup.py test -q
pep8 --repeat --show-source testing123/setup.py testing123/testing123
{envpython} {toxinidir}/pecan/tests/scaffold_builder.py
[testenv:pep8]
deps = pep8
commands = pep8 --repeat --show-source --exclude *compat*,resources.py pecan setup.py