Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tests to use tox with travis #9

Merged
merged 6 commits into from Dec 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -4,3 +4,4 @@
build
dist
*.egg-info
.tox
14 changes: 8 additions & 6 deletions .travis.yml
@@ -1,9 +1,11 @@
language: python
python:
- "2.6"
script: ./run_tests.sh
install:
pip install -r requirements.txt -r test_requirements.txt
install: pip install tox
script: tox -v -e $TOX_ENV -- --verbose
sudo: false
env:
- TOX_ENV=py26pep8
- TOX_ENV=py26-coverage
- TOX_ENV=py26
notifications:
email:
- jason.louard.ward@gmail.com
- development@policystat.com
5 changes: 4 additions & 1 deletion MANIFEST.in
@@ -1 +1,4 @@
include MANIFEST.in README.rst
include MANIFEST.in
include README.rst
recursive-include requirements *.txt
prune htmltreediff/*.pyc
2 changes: 1 addition & 1 deletion htmltreediff/text.py
Expand Up @@ -160,7 +160,7 @@ def match_length(self):
length = 0
for match in self.get_matching_blocks():
a, b, size = match
length += self._text_length(self.a[a:a+size])
length += self._text_length(self.a[a:a + size])
return length

def _text_length(self, word_sequence):
Expand Down
File renamed without changes.
File renamed without changes.
21 changes: 17 additions & 4 deletions setup.py
@@ -1,17 +1,29 @@
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# coding: utf-8

import codecs
import os

try:
from setuptools import setup, find_packages, Command
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages, Command
from setuptools import setup, find_packages

long_description = codecs.open("README.rst", "r", "utf-8").read()


def strip_comments(l):
return l.split('#', 1)[0].strip()


def get_requirements(path):
for line in open(os.path.join(os.getcwd(), path)).readlines():
line = strip_comments(line)
if line:
yield line

setup(
name="html-tree-diff",
version="0.1.2",
Expand All @@ -24,7 +36,8 @@
packages=find_packages(),
scripts=[],
zip_safe=False,
install_requires=['lxml', 'html5lib'],
install_requires=list(get_requirements('requirements/default.txt')),
tests_require=list(get_requirements('requirements/testing.txt')),
cmdclass={},
classifiers=[
"Development Status :: 3 - Alpha",
Expand Down
27 changes: 27 additions & 0 deletions tox.ini
@@ -0,0 +1,27 @@
# Tox (http://tox.testrun.org/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
envlist = py26pep8, py26, py26-coverage

[testenv]
commands =
nosetests --with-doctest []
deps =
-r{toxinidir}/requirements/testing.txt

# Coverage for python 2.7
[testenv:py26-coverage]
commands =
nosetests --with-doctest --with-coverage --cover-package htmltreediff []

[testenv:py26pep8]
basepython = python2.6
deps = flake8
commands = flake8 htmltreediff

[flake8]
select = E,W,F
max-line-length = 95