From 960636d2c42ecb0ba725f2f4e834f13bd1ab6283 Mon Sep 17 00:00:00 2001 From: stroeder Date: Tue, 14 Feb 2017 21:38:13 +0000 Subject: [PATCH] running tests made easier now --- CHANGES | 6 +++++- MANIFEST.in | 1 + Tests/__init__.py | 15 +++++++++++++++ Tests/runtests.sh | 27 --------------------------- Tests/t_cext.py | 4 +++- setup.py | 3 ++- tox.ini | 13 +++++++++++++ 7 files changed, 39 insertions(+), 30 deletions(-) create mode 100644 Tests/__init__.py delete mode 100755 Tests/runtests.sh create mode 100644 tox.ini diff --git a/CHANGES b/CHANGES index 60ed0c1..1c5ef5c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ ---------------------------------------------------------------- Released 2.4.32 2017-02-14 +Running tests made easier: +- python setup.py test +- added tox.ini + ---------------------------------------------------------------- Released 2.4.31 2017-02-14 @@ -1332,4 +1336,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.408 2017/02/14 21:36:01 stroeder Exp $ +$Id: CHANGES,v 1.409 2017/02/14 21:38:13 stroeder Exp $ diff --git a/MANIFEST.in b/MANIFEST.in index 7ea2fdd..459af43 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,4 +3,5 @@ include Modules/*.c Modules/*.h Modules/LICENSE recursive-include Build *.cfg* recursive-include Lib *.py recursive-include Demo *.py +include tox.ini recursive-include Tests *.py diff --git a/Tests/__init__.py b/Tests/__init__.py new file mode 100644 index 0000000..739dd08 --- /dev/null +++ b/Tests/__init__.py @@ -0,0 +1,15 @@ +""" +python-ldap tests module package +""" + +import t_cext +import t_ldap_dn +import t_ldap_filter +import t_ldap_functions +import t_ldap_modlist +import t_ldap_schema_tokenizer +import t_ldapurl +import t_ldif +import t_search + +import slapd \ No newline at end of file diff --git a/Tests/runtests.sh b/Tests/runtests.sh deleted file mode 100755 index 7230c6e..0000000 --- a/Tests/runtests.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# -# This script runs all the t_*.py tests in the current directory, -# preparing PYTHONPATH to use the most recent local build -# -# Run with -v option for verbose -# - -set -e -: ${PYTHON:="python"} -plat_specifier=`$PYTHON -c 'import sys,distutils.util; \ - print(distutils.util.get_platform()+"-"+sys.version[0:3])'` -failed= -for test in t_*.py -do - echo "$test:" - PYTHONPATH="../build/lib.$plat_specifier" $PYTHON "$test" "$@" || - failed="$failed $test" -done - -if test -n "$failed"; then - echo "Tests that failed:$failed" >&2 - exit 1 -else - echo "All tests passed. Yay." - exit 0 -fi diff --git a/Tests/t_cext.py b/Tests/t_cext.py index fd17ee9..159d6fb 100644 --- a/Tests/t_cext.py +++ b/Tests/t_cext.py @@ -1,8 +1,10 @@ -import unittest, slapd +import unittest import _ldap import logging +from Tests import slapd + reusable_server = None def get_reusable_server(): global reusable_server diff --git a/setup.py b/setup.py index 0088b8f..5b1241a 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ See http://www.python-ldap.org/ for details. -$Id: setup.py,v 1.77 2017/02/14 19:07:15 stroeder Exp $ +$Id: setup.py,v 1.78 2017/02/14 21:38:13 stroeder Exp $ """ has_setuptools = False @@ -180,5 +180,6 @@ class OpenLDAP2: ], package_dir = {'': 'Lib',}, data_files = LDAP_CLASS.extra_files, + test_suite = 'Tests', **kwargs ) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..d11ce1c --- /dev/null +++ b/tox.ini @@ -0,0 +1,13 @@ +# 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 = py27 + +[testenv] +commands = {envpython} setup.py test +deps = + pyasn1 + pyasn1_modules