Skip to content

Commit

Permalink
tox runs tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitbryon committed Feb 27, 2014
1 parent 57285f3 commit 20d8773
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 151 deletions.
13 changes: 9 additions & 4 deletions .travis.yml
@@ -1,5 +1,10 @@
language: python
python:
- "2.7"
install: make configure develop
script: make test
env:
- TOXENV=py27
- TOXENV=flake8
- TOXENV=sphinx
- TOXENV=readme
install:
- pip install tox
script:
- tox
2 changes: 1 addition & 1 deletion MANIFEST.in
@@ -1,3 +1,3 @@
recursive-include diecutter *
global-exclude *.pyc .*.swp
include AUTHORS CHANGELOG INSTALL LICENSE README VERSION
include AUTHORS CHANGELOG INSTALL LICENSE README.rst VERSION
48 changes: 22 additions & 26 deletions Makefile
Expand Up @@ -3,6 +3,9 @@
# For standard installation of diecutter, see INSTALL.
# For details about diecutter's development environment, see CONTRIBUTING.rst.
#
PIP = pip
RELEASE = fullrelease
TOX = tox
WGET = wget
PROJECT = $(shell python -c "import setup; print setup.NAME")
DIECUTTER_PUBLIC_API = http://diecutter.io/api
Expand Down Expand Up @@ -34,8 +37,8 @@ configure:

#: develop - Install minimal development utilities (tox, Sphinx, ...).
develop:
pip install -r tests-requirements.pip
rm -rf *.egg
$(PIP) install tox


#: clean - Basic cleanup, mostly temporary files.
clean:
Expand All @@ -44,11 +47,17 @@ clean:

#: distclean - Remove local builds, such as *.egg-info.
distclean: clean
rm -rf *.egg
rm -rf *.egg-info


#: maintainer-clean - Remove almost everything that can be re-generated.
maintainer-clean: distclean
rm -rf bin/
rm -rf lib/
rm -rf build/
rm -rf dist/
rm -rf .tox/


#: serve - Run local diecutter server.
Expand All @@ -57,28 +66,12 @@ serve:


#: test - Run test suites.
test: test-app test-pep8


test-app:
mkdir -p var/test
nosetests --config=etc/nose.cfg --config=etc/nose-app.cfg $(PROJECT) tests


test-pep8:
flake8 $(PROJECT) tests


test-documentation:
nosetests -c etc/nose.cfg sphinxcontrib.testbuild.tests
test:
$(TOX)


#: documentation - Build documentation (Sphinx, README, ...)
documentation: sphinx-doctest sphinx-apidoc sphinx-html


sphinx-doctest: sphinx-apidoc-clean
make --directory=docs clean doctest
documentation: sphinx readme


# Remove auto-generated API documentation files.
Expand All @@ -94,9 +87,13 @@ sphinx-apidoc: sphinx-apidoc-clean
sphinx-apidoc --suffix txt --output-dir docs/framework/api $(PROJECT)


sphinx-html:
mkdir -p docs/_static
make --directory=docs clean html
sphinx:
tox -e sphinx


#: readme - Build standalone documentation files (README, CONTRIBUTING...).
readme:
tox -e readme


generate-documentation:
Expand All @@ -107,5 +104,4 @@ generate-documentation:

#: release - Tag and push to PyPI.
release:
pip install zest.releaser
fullrelease
tox -e release
59 changes: 0 additions & 59 deletions README

This file was deleted.

1 change: 0 additions & 1 deletion README.rst

This file was deleted.

59 changes: 59 additions & 0 deletions README.rst
@@ -0,0 +1,59 @@
#########
diecutter
#########

Templates as a service.

``diecutter`` exposes an API where you manage templates as resources.
The most common operation is to **POST data to templates in order to retrieve
generated files**.

Files and directories are supported. Directories are rendered as archives.

.. note::

Diecutter is under active development: some (killer) features have not been
implemented yet, or they are not mature.
Check `milestones <https://github.com/novagile/diecutter/issues/milestones>`_
and `vision <https://diecutter.readthedocs.org/en/latest/about/vision.html>`_
for details.

That said, features documented below actually work, so **give it a try!**

.. image:: https://secure.travis-ci.org/diecutter/diecutter.png?branch=master
:alt: Build Status
:target: https://secure.travis-ci.org/diecutter/diecutter
.. image:: https://pypip.in/v/diecutter/badge.png
:target: https://python.org/pypi/diecutter/
.. image:: https://pypip.in/d/diecutter/badge.png
:target: https://python.org/pypi/diecutter/

*******
Example
*******

GET raw content of a template:

.. code-block:: text
$ curl -X GET http://diecutter.io/api/greetings.txt
{{ greetings|default('Hello') }} {{ name }}!
POST data to the template and retrieve generated content:

.. code-block:: text
$ curl -X POST -d name=world http://diecutter.io/api/greetings.txt
Hello world!
**********
Ressources
**********

* Documentation: http://diecutter.readthedocs.org
* Online demo: http://diecutter.io
* PyPI page: http://pypi.python.org/pypi/diecutter
* Code repository: https://github.com/novagile/diecutter
* Bugtracker: https://github.com/novagile/diecutter/issues
* Continuous integration: https://travis-ci.org/novagile/diecutter
7 changes: 6 additions & 1 deletion diecutter/service.py
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
"""Services expose diecutter API."""
from collections import OrderedDict

import cornice
from pyramid.config import Configurator
from pyramid.exceptions import ConfigurationError
Expand All @@ -17,7 +19,10 @@ class Service(object):
"""Base class for diecutter services."""
def hello(self, request):
"""Returns Hello and API version in JSON."""
return {'diecutter': 'Hello', 'version': diecutter.__version__}
return OrderedDict((
('diecutter', 'Hello'),
('version', diecutter.__version__),
))

def get(self, request):
raise HTTPNotImplemented()
Expand Down
4 changes: 2 additions & 2 deletions docs/Makefile
Expand Up @@ -3,7 +3,7 @@

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = ../bin/sphinx-build
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = ../var/docs

Expand Down Expand Up @@ -150,4 +150,4 @@ linkcheck:
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
"results in $(BUILDDIR)/doctest/output.txt."
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -7,7 +7,7 @@
here = os.path.abspath(os.path.dirname(__file__))

NAME = 'diecutter'
README = open(os.path.join(here, 'README')).read()
README = open(os.path.join(here, 'README.rst')).read()
VERSION = open(os.path.join(here, 'VERSION')).read().strip()
PACKAGES = [NAME]
REQUIREMENTS = ['setuptools',
Expand All @@ -18,6 +18,7 @@
'django',
'Jinja2',
'mock',
'requests',
'webtest']


Expand Down
56 changes: 0 additions & 56 deletions tests/readme.py

This file was deleted.

48 changes: 48 additions & 0 deletions tox.ini
@@ -0,0 +1,48 @@
[tox]
envlist = py27, flake8, sphinx, readme

[testenv]
deps =
nose
rednose
coverage
commands =
python setup.py install
nosetests --config=etc/nose.cfg --config=etc/nose-app.cfg diecutter tests
rm .coverage
pip freeze
whitelist_externals =
rm

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

[testenv:sphinx]
deps =
nose
rednose
Sphinx
commands =
python setup.py install
make --directory=docs clean html
whitelist_externals =
make

[testenv:readme]
deps =
docutils
pygments
commands =
mkdir -p var/docs
rst2html.py --exit-status=2 README.rst var/docs/README.html
whitelist_externals =
mkdir

[testenv:release]
deps =
zest.releaser
commands =
fullrelease

0 comments on commit 20d8773

Please sign in to comment.