From 2aefaa0793bf067e2d1d7deeafc066243b307a9e Mon Sep 17 00:00:00 2001 From: Benjamin Hedrich Date: Sat, 10 May 2014 19:31:22 +0200 Subject: [PATCH] sdd --- .travis.yml | 8 +++++++- pytest.ini | 3 +-- setup.py | 27 ++++++++++++++++++++++++++- tox.ini | 22 +++++++++++++++++----- 4 files changed, 51 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4c8571a..6a27b1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,19 @@ language: python +before_script: + - "export DISPLAY=:99.0" + - "sh -e /etc/init.d/xvfb start" + - sleep 3 + env: - TOX_ENV=py27 + - TOX_ENV=py27-withgui python: - "2.7" install: - - "pip install tox==1.7.1" + - "pip install tox==1.7.1 coveralls" script: - "tox -e $TOX_ENV" diff --git a/pytest.ini b/pytest.ini index aa5857d..dcbf237 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,3 +1,2 @@ [pytest] -norecursedirs = .tox - requirements +addopts = --cov-report html --cov=keepass_http --cov-report=term-missing tests diff --git a/setup.py b/setup.py index 8197897..5c96e89 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,24 @@ # -*- coding: utf-8 -*- from setuptools import find_packages, setup +from setuptools.command.test import test as TestCommand + +import sys + +class PyTest(TestCommand): + def finalize_options(self): + TestCommand.finalize_options(self) + print sys.argv + self.test_args = [] + self.test_suite = True + + def run_tests(self): + #import here, cause outside the eggs aren't loaded + import pytest + errno = pytest.main(self.test_args) + sys.exit(errno) + +#with open("requirements/testing.txt") as x: +# test_requirements = x.read().splitlines() with open("README.rst") as readme_file: long_description = readme_file.read() @@ -21,7 +40,7 @@ "flask==0.10.1", "keepass==1.2", "libkeepass==0.1.2", - "lxml>=3.2"), + "lxml==3.2.1"), extras_require = { 'GUI': ("PySide==1.2.2",) }, @@ -34,5 +53,11 @@ 'application/x-keepass-database-v2 = keepass_http.backends.libkeepass_backend:Backend' ], }, + tests_require=["pytest==2.5.2", +"pytest-cov==1.6", +"coveralls==0.4.2", +"mock==1.0.1", +], + cmdclass = {'test': PyTest}, zip_safe=False ) diff --git a/tox.ini b/tox.ini index 29ab588..956401a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,20 @@ [tox] -envlist = py27 +envlist = py27, + py27-withgui -[py27] -basepython = python2.7 +[base] whitelist_externals = make -deps = -rrequirements/testing.txt -commands = make run_tests + +[testenv:py27] +basepython = python2.7 +whitelist_externals = {[base]whitelist_externals} +commands = python setup.py test + +[testenv:py27-withgui] +basepython = python2.7 +whitelist_externals = {[base]whitelist_externals} +commands = python setup.py test +deps = PySide==1.2.2 + pytest-qt==1.0.2 + +