Skip to content

Commit

Permalink
added tox support
Browse files Browse the repository at this point in the history
  • Loading branch information
tarekziade committed Sep 13, 2013
1 parent 86b91c4 commit e5f5412
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 8 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*.pyc
lib
include
bin
*.un~
*.egg-info
.Python
.tox
build
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
.PHONY: docs
.PHONY: docs test

BIN = `pwd`/bin

ifndef VTENV_OPTS
VTENV_OPTS = "--no-site-packages"
endif

test:
$(BIN)/pip install tox
$(BIN)/tox

bin/python:
virtualenv $(VTENV_OPTS) .
bin/python setup.py develop
$(BIN)/python setup.py develop

docs: bin/python
bin/pip install sphinx
SPHINXBUILD=../bin/sphinx-build $(MAKE) -C docs html $^
$(BIN)/pip install sphinx
$(BIN)/sphinx-build -b html -d docs/build/doctrees docs/source build/html

12 changes: 8 additions & 4 deletions chaussette/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from chaussette.backend import get, backends


def make_server(app, host=None, port=None, backend='wsgiref', backlog=2048, spawn=None,
logger=None, address_family=socket.AF_INET,
def make_server(app, host=None, port=None, backend='wsgiref', backlog=2048,
spawn=None, logger=None, address_family=socket.AF_INET,
socket_type=socket.SOCK_STREAM):
logger = logger or chaussette_logger
logger.info('Application is %r' % app)
Expand All @@ -34,7 +34,9 @@ def make_server(app, host=None, port=None, backend='wsgiref', backlog=2048, spaw
try:
server = server_class((host, port), app, **server_class_kwargs)
except TypeError:
logger.exception("Failed to create backend %s, you might be trying to use --spawn on a backend that does not support it" % backend)
logger.exception("Failed to create backend %s, you might be trying "
"to use --spawn on a backend that does "
"not support it" % backend)
raise
return server

Expand Down Expand Up @@ -119,7 +121,9 @@ def main():
choices=backends())
parser.add_argument('--use-reloader', action='store_true',
help="Restart server when source files change")
parser.add_argument('--spawn', type=int, default=None, help="Spawn type, only makes sense if the backend supports it (gevent)")
parser.add_argument('--spawn', type=int, default=None,
help="Spawn type, only makes sense if the backend "
"supports it (gevent)")
parser.add_argument('application', default='chaussette.util.hello_app',
nargs='?')
parser.add_argument('--pre-hook', type=str, default=None)
Expand Down
15 changes: 15 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[tox]
envlist = flake8,py26,py27,py33,docs

[testenv]
commands =
python setup.py develop
python setup.py test

[testenv:docs]
deps = Sphinx
commands = /usr/bin/make docs

[testenv:flake8]
deps = flake8
commands = flake8 chaussette

0 comments on commit e5f5412

Please sign in to comment.