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

28
tox.ini
View File

@@ -1,5 +1,5 @@
[tox] [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] [testenv]
commands={envpython} setup.py test -v commands={envpython} setup.py test -v
@@ -26,6 +26,32 @@ commands=pecan create testing123
pep8 --repeat --show-source testing123/setup.py testing123/testing123 pep8 --repeat --show-source testing123/setup.py testing123/testing123
{envpython} {toxinidir}/pecan/tests/scaffold_builder.py {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] [testenv:pep8]
deps = pep8 deps = pep8
commands = pep8 --repeat --show-source --exclude *compat*,resources.py pecan setup.py commands = pep8 --repeat --show-source --exclude *compat*,resources.py pecan setup.py