Skip to content

Commit

Permalink
Merge pull request #211 from onefinestay/tox
Browse files Browse the repository at this point in the history
Tox
  • Loading branch information
mattbennett committed Feb 20, 2015
2 parents 5c5b86e + f070b91 commit 67d6303
Show file tree
Hide file tree
Showing 13 changed files with 108 additions and 93 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ docs/build
## Packages
*.egg-info
dist
.tox
22 changes: 15 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,29 @@ language: python
python:
- "2.7"

services:
- rabbitmq

install:
- python setup.py -q install
- sudo apt-get install libenchant-dev
- pip install -r dev_requirements.txt
- pip install tox

services:
- rabbitmq
env:
- TOX_ENV=pinned
- TOX_ENV=latest
- TOX_ENV=docs
- TOX_ENV=spelling

script:
- make test
- make docs
- make spelling
- tox -e $TOX_ENV

notifications:
email: false
irc:
channels:
- "chat.freenode.net#nameko"
use_notice: true
skip_join: true
hipchat:
rooms:
secure: HdQuYHfBbCnuw0mgj1tJOdlXRhF+b9Ena6JVp1nPdCjP5WX8iCpDAtR4vlTry4X6eNXodb0xsdhWmN9Zq+iDvR0FQvvtRkFUxNpxsqGPLClvUIthTNqjGLgl2lMtbZcHRT1dj/wrKY/yAVdGs/FF/Ghz0MQZgiWtGA5hnb3kZAI=
Expand Down
2 changes: 1 addition & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Version 1.11.0
* Add default retry policies to all publishers
* Stricter handling of connections between tests
* Workarounds for RabbitMQ bugs described at
https://groups.google.com/forum/#!topic/rabbitmq-users/lrl0tYd1L38
https://groups.google.com/d/topic/rabbitmq-users/lrl0tYd1L38/discussion

Version 1.10.1
--------------
Expand Down
41 changes: 12 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,42 +1,25 @@
# See https://bugs.launchpad.net/pyflakes/+bug/1223150
export PYFLAKES_NODOCTEST=1
# shortcuts for local dev
#
.PHONY: test flake8 pylint pytest docs spelling test_docs

noop:
@true

.PHONY: noop

requirements:
pip install -r dev_requirements.txt -q

develop: requirements
python setup.py -q develop

pytest:
coverage run --concurrency=eventlet --source nameko -m pytest test
test: flake8 pylint pytest

flake8:
flake8 nameko test

pylint:
pylint nameko -E

test: flake8 pylint pytest coverage-check

full-test: requirements test

coverage-check:
pytest:
coverage run --concurrency=eventlet --source nameko -m pytest test
coverage report --fail-under=100

sphinx: develop
sphinx-build -n -b html -d docs/build/doctrees docs docs/build/html
docs:
tox -e docs

spelling:
sphinx-build -b spelling -d docs/build/doctrees docs docs/build/spelling

docs/modules.rst: $(wildcard nameko/*.py) $(wildcard nameko/**/*.py)
sphinx-apidoc -e -f -o docs/api nameko

autodoc: docs/modules.rst
tox -e spelling

docs: sphinx spelling
test_docs:
spelling
docs
15 changes: 0 additions & 15 deletions dev_requirements.txt

This file was deleted.

9 changes: 9 additions & 0 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ Use GitHub `issues <https://github.com/onefinestay/nameko/issues>`_ to report bu

You're welcome to `fork <https://github.com/onefinestay/nameko/fork>`_ the repository and raise a pull request with your contributions.

You can install all the development dependencies using::

pip install -e .[dev]

and the requirements for building docs using::

pip install -e .[docs]


Pull requests are automatically built with `Travis-CI <https://travis-ci.org/onefinestay/nameko/>`_. Travis will fail the build unless all of the following are true:

* All tests pass
Expand Down
1 change: 1 addition & 0 deletions docs/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pre
programmatically
pseudocode
py
pytest
rabbitmq
reconnected
reconnecting
Expand Down
4 changes: 2 additions & 2 deletions nameko/nameko_doc/processor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from path import path
from path import Path
from .method_extractor import MethodExtractor
from .rst_render import RstPagePrinter

Expand All @@ -9,7 +9,7 @@

class ServiceDocProcessor(object):
def __init__(self, output, service_loader_function):
self.output = path(output)
self.output = Path(output)
self.service_loader_function = service_loader_function

def write_docs(self):
Expand Down
4 changes: 2 additions & 2 deletions nameko/nameko_doc/rst_render.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections import namedtuple
from path import path
from path import Path

SERVICE_INDEX_FILENAME = 'index.rst'

Expand Down Expand Up @@ -37,7 +37,7 @@ def _file_path(self, file_name):

@property
def output_path(self):
return path(self.output)
return Path(self.output)

@property
def sorted_pages(self):
Expand Down
2 changes: 1 addition & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ load-plugins=
output-format=colorized

# Include message's id in output
include-ids=yes
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}

# Include symbolic ids of messages in output
symbols=no
Expand Down
7 changes: 0 additions & 7 deletions requirements.txt

This file was deleted.

58 changes: 29 additions & 29 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,7 @@
#!/usr/bin/env python
from setuptools import setup, find_packages
from os.path import abspath, dirname, join


setup_dir = dirname(abspath(__file__))


def parse_requirements(fn, dependency_links):
requirements = []
with open(fn, 'rb') as f:
for dep in f:
dep = dep.strip()
# need to make test_requirements.txt work with
# setuptools like it would work with `pip -r`
# URLs will not work, so we transform them to
# dependency_links and requirements
if dep.startswith('-e '):
dep = dep[3:]

if dep.startswith('git+'):
dependency_links.append(dep)
_, dep = dep.rsplit('#egg=', 1)
dep = dep.replace('-', '==', 1)
requirements.append(dep)

return requirements, dependency_links

requirements, dependency_links = parse_requirements(
join(setup_dir, 'requirements.txt'), [])

setup(
name='nameko',
version='1.14.0',
Expand All @@ -39,8 +12,35 @@ def parse_requirements(fn, dependency_links):
author_email='nameko-devs@onefinestay.com',
url='http://github.com/onefinestay/nameko',
packages=find_packages(exclude=['test', 'test.*']),
install_requires=requirements,
dependency_links=dependency_links,
install_requires=[
"eventlet",
"iso8601",
"kombu<=3.0.4",
"mock",
"path.py>=6.2",
"pyrabbit",
"Werkzeug",
],
extras_require={
'dev': [
"coverage==4.0a1",
"flake8==2.1.0",
"mccabe==0.3",
"pep8==1.6.1",
"pyflakes==0.8.1",
"pylint==1.0.0",
"pytest==2.4.2",
"pytest-timeout==0.4",
"requests==2.5.0",
"websocket-client==0.23.0",
],
'docs': [
"pyenchant==1.6.6",
"Sphinx==1.2",
"sphinxcontrib-spelling==2.1.1",
"sphinx-rtd-theme==0.1.6",
],
},
entry_points={
'console_scripts': [
'nameko=nameko.cli.main:main',
Expand Down
35 changes: 35 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[tox]
envlist = {pinned,latest}, docs, spelling
skipsdist = True

[testenv]
deps =
latest: eventlet # need something
pinned: eventlet==0.15.2
pinned: iso8601==0.1.8
pinned: kombu==3.0.4
pinned: mock==1.0.1
pinned: path.py==5.1
pinned: pyrabbit==1.1.0
pinned: Werkzeug==0.9.6

commands =
pip install --editable .[dev]
flake8 nameko test
pylint --rcfile=pylintrc nameko -E
coverage run --concurrency=eventlet --source nameko -m \
pytest test {posargs:--timeout=30}
coverage report --fail-under=100


[testenv:docs]
commands =
pip install --editable .[docs]
sphinx-build -n -b html -d {envtmpdir}/doctrees docs {envtmpdir}/html


[testenv:spelling]
commands =
pip install --editable .[docs]
sphinx-build -b spelling -d {envtmpdir}/doctrees docs {envtmpdir}/spelling
# sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees docs {envtmpdir}/linkcheck

0 comments on commit 67d6303

Please sign in to comment.