This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch pu/reproducible_builds
in repository dh-python.

commit b89e48a60f35132b4e81709874de54b857aebcca
Author: Piotr Ożarowski <pi...@debian.org>
Date:   Tue Aug 27 22:21:58 2013 +0200

    pybuild: add --test-tox option
---
 debian/changelog       |  9 ++++++---
 dhpython/build/base.py | 12 +++++++++++-
 pybuild                |  6 +++++-
 pybuild.rst            |  3 +++
 4 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 499b48c..3b2e53a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,9 +5,12 @@ dh-python (1.20130830-1) UNRELEASED; urgency=low
     (broken in previous upload, closes: #720744)
 
   [ Piotr Ożarowski ]
-  * Add Barry Warsow to co-maintainers
-  * Mention {version.major} and {version.minor} in pybuild's manpage
-    (closes: 721068)
+  * Add Barry Warsaw to co-maintainers
+  * pybuild:
+    - mention {version.major} and {version.minor} in pybuild's manpage
+      (closes: 721068)
+    - add --test-tox option (PYBUILD_TEST_TOX=1 works too, like with
+      other pybuild options), closes: 721067
 
  -- Piotr Ożarowski <pi...@debian.org>  Sun, 25 Aug 2013 12:39:39 +0200
 
diff --git a/dhpython/build/base.py b/dhpython/build/base.py
index 3a0c224..48a7a75 100644
--- a/dhpython/build/base.py
+++ b/dhpython/build/base.py
@@ -22,7 +22,7 @@ import logging
 from functools import wraps
 from glob import glob1
 from os import remove, walk
-from os.path import join
+from os.path import isdir, join
 from subprocess import Popen, PIPE
 from shutil import rmtree
 from dhpython.tools import execute
@@ -111,6 +111,14 @@ class Base:
         return result
 
     def clean(self, context, args):
+        if self.cfg.test_tox:
+            tox_dir = join(args['dir'], '.tox')
+            if isdir(tox_dir):
+                try:
+                    rmtree(tox_dir)
+                except Exception:
+                    log.debug('cannot remove %s', tox_dir)
+
         for root, dirs, file_names in walk(context['dir']):
             for name in dirs:
                 if name == '__pycache__':
@@ -145,6 +153,8 @@ class Base:
             return 'cd {build_dir}; {interpreter} -m nose --with-doctest 
{args}'
         elif self.cfg.test_pytest:
             return 'cd {build_dir}; {interpreter} -m pytest {args}'
+        elif self.cfg.test_tox:
+            return 'cd {build_dir}; tox -c {dir}/tox.ini -e 
py{version.major}{version.minor}'
         elif args['version'] == '2.7' or args['version'] >> '3.1' or 
args['interpreter'] == 'pypy':
             return 'cd {build_dir}; {interpreter} -m unittest discover -v 
{args}'
 
diff --git a/pybuild b/pybuild
index e9c2d24..6e041c9 100755
--- a/pybuild
+++ b/pybuild
@@ -363,6 +363,9 @@ def parse_args(argv):
     tests.add_argument('--test-pytest', action='store_true',
                        default=environ.get('PYBUILD_TEST_PYTEST') == '1',
                        help='use pytest module in --test step')
+    tests.add_argument('--test-tox', action='store_true',
+                       default=environ.get('PYBUILD_TEST_TOX') == '1',
+                       help='use tox in --test step')
 
     dirs = parser.add_argument_group('DIRECTORIES')
     dirs.add_argument('-d', '--dir', action='store', metavar='DIR',
@@ -406,7 +409,8 @@ def parse_args(argv):
             versions.extend(version.split())
         args.versions = versions
 
-    if args.test_nose or args.test_pytest or args.system == 'custom':
+    if args.test_nose or args.test_pytest or args.test_tox\
+       or args.system == 'custom':
         args.custom_tests = True
     else:
         args.custom_tests = False
diff --git a/pybuild.rst b/pybuild.rst
index 4a1c82b..c0c9d4a 100644
--- a/pybuild.rst
+++ b/pybuild.rst
@@ -63,6 +63,9 @@ TESTS
     --test-pytest
         use pytest module in test step, remember to add python-pytest and/or
         python3-pytest to Build-Depends
+    --test-tox
+        use tox command in test step, remember to add python-tox
+        to Build-Depends. Requires tox.ini file
 
 BUILD SYSTEM ARGUMENTS
 ----------------------

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/reproducible/dh-python.git

_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to