diff --git a/.gitignore b/.gitignore index a0e39ffd165..ab6b7da7269 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,6 @@ samples/client/petstore/php/SwaggerClient-php/vendor/ samples/client/petstore/silex/SwaggerServer/composer.lock samples/client/petstore/silex/SwaggerServer/venodr/ + +samples/client/petstore/python/.projectile +samples/client/petstore/python/.venv/ diff --git a/samples/client/petstore/python/.travis.yml b/samples/client/petstore/python/.travis.yml new file mode 100644 index 00000000000..bde258c4161 --- /dev/null +++ b/samples/client/petstore/python/.travis.yml @@ -0,0 +1,12 @@ +language: python +python: + - "2.6" + - "2.7" + - "3.2" + - "3.3" + - "3.4" +install: + - pip install . --use-mirrors + - pip install -r dev-requirements.txt --use-mirrors +script: + - nosetests diff --git a/samples/client/petstore/python/Makefile b/samples/client/petstore/python/Makefile index 2811b735b54..b1c318aadb7 100644 --- a/samples/client/petstore/python/Makefile +++ b/samples/client/petstore/python/Makefile @@ -1,22 +1,9 @@ + #!/bin/sh + REQUIREMENTS_FILE=dev-requirements.txt REQUIREMENTS_OUT=dev-requirements.txt.log SETUP_OUT=*.egg-info - -virtualenv: -ifndef VIRTUAL_ENV - $(error Must be run inside of a virtualenv\ - http://docs.python-guide.org/en/latest/dev/virtualenvs/) -endif - -setup: virtualenv $(SETUP_OUT) - -$(SETUP_OUT): setup.py setup.cfg - python setup.py develop - touch $(SETUP_OUT) - -$(REQUIREMENTS_OUT): $(REQUIREMENTS_FILE) - pip install -r $(REQUIREMENTS_FILE) | tee -a $(REQUIREMENTS_OUT) - python setup.py develop +VENV=.venv clean: rm -rf $(REQUIREMENTS_OUT) @@ -26,12 +13,8 @@ clean: find . -name "*.py[oc]" -delete find . -name "__pycache__" -delete -requirements: setup $(REQUIREMENTS_OUT) - -test: clean requirements - nosetests - -test-all: clean requirements - tox - +test: clean + sh ./test.sh +test-all: clean + sh ./test-all.sh diff --git a/samples/client/petstore/python/pom.xml b/samples/client/petstore/python/pom.xml index 9efbfb0a35d..b3feaf688a9 100644 --- a/samples/client/petstore/python/pom.xml +++ b/samples/client/petstore/python/pom.xml @@ -26,6 +26,20 @@ exec-maven-plugin 1.2.1 + + pip-install + pre-integration-test + + exec + + + pip + + install + virtualenv + + + nose-test integration-test @@ -44,14 +58,3 @@ - - - - - - - - - - - diff --git a/samples/client/petstore/python/test-all.sh b/samples/client/petstore/python/test-all.sh new file mode 100755 index 00000000000..e62a66c3aae --- /dev/null +++ b/samples/client/petstore/python/test-all.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +REQUIREMENTS_FILE=dev-requirements.txt +REQUIREMENTS_OUT=dev-requirements.txt.log +SETUP_OUT=*.egg-info +VENV=.venv + +### set virtualenv +if [ -z "$VIRTUAL_ENV" ]; then + virtualenv $VENV --no-site-packages + source $VENV/bin/activate +fi + +### install dependencies +pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT +python setup.py develop + +### run tests +tox diff --git a/samples/client/petstore/python/test.sh b/samples/client/petstore/python/test.sh new file mode 100755 index 00000000000..309275e6ead --- /dev/null +++ b/samples/client/petstore/python/test.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +REQUIREMENTS_FILE=dev-requirements.txt +REQUIREMENTS_OUT=dev-requirements.txt.log +SETUP_OUT=*.egg-info +VENV=.venv + +### set virtualenv +if [ -z "$VIRTUAL_ENV" ]; then + virtualenv $VENV --no-site-packages + source $VENV/bin/activate +fi + +### install dependencies +pip install -r $REQUIREMENTS_FILE | tee -a $REQUIREMENTS_OUT +python setup.py develop + +### run tests +nosetests