[Reproducible-builds] [dh-python] 67/183: pybuild: add --test-nose and --test-pytest options

Jérémy Bobbio lunar at moszumanska.debian.org
Fri Sep 19 15:30:21 UTC 2014


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 bbe5cc30b1924f54aab1fcefd68be72be15030a5
Author: Piotr Ożarowski <piotr at debian.org>
Date:   Wed Aug 7 23:52:50 2013 +0200

    pybuild: add --test-nose and --test-pytest options
---
 debian/changelog       |  2 ++
 dhpython/build/base.py |  6 +++++-
 pybuild                |  9 +++++++++
 pybuild.rst            | 12 ++++++++++++
 4 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 3050026..3db1ddd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ dh-python (1.20130807-1) unstable; urgency=low
   * pybuild:
     - rename PYBUILD_DEBUG env. var. to PYBUILD_VERBOSE
     - run `pypy -m unittest discover -v` in test target for pypy interpreter
+    - add --test-nose and --test-pytest options (can be enabled also via
+      PYBUILD_TEST_NOSE=1 or PYBUILD_TEST_PYTEST=1)
 
  -- Piotr Ożarowski <piotr at debian.org>  Sat, 03 Aug 2013 12:41:15 +0200
 
diff --git a/dhpython/build/base.py b/dhpython/build/base.py
index 523fdb9..64e1ad0 100644
--- a/dhpython/build/base.py
+++ b/dhpython/build/base.py
@@ -133,7 +133,11 @@ class Base:
         raise NotImplementedError("build method not implemented in %s" % self.NAME)
 
     def test(self, context, args):
-        if args['version'] == '2.7' or args['version'] >> '3.1' or args['interpreter'] == 'pypy':
+        if self.cfg.test_nose:
+            return 'cd {build_dir}; {interpreter} -m nose --with-doctest {args}'
+        elif self.cfg.test_pytest:
+            return 'cd {build_dir}; {interpreter} -m pytest {args}'
+        elif args['version'] == '2.7' or args['version'] >> '3.1' or args['interpreter'] == 'pypy':
             return 'cd {build_dir}; {interpreter} -m unittest discover -v {args}'
 
     def execute(self, context, args, command, log_file=None):
diff --git a/pybuild b/pybuild
index dd5826f..9ea6b93 100755
--- a/pybuild
+++ b/pybuild
@@ -354,6 +354,15 @@ def parse_args(argv):
     arguments.add_argument('--after-test', metavar='CMD',
                            help='invoked after the test command')
 
+    tests = parser.add_argument_group('TESTS', '''\
+        unittest\'s discover is used by default (if available)''')
+    tests.add_argument('--test-nose', action='store_true',
+                       default=environ.get('PYBUILD_TEST_NOSE') == '1',
+                       help='use nose module in --test step')
+    tests.add_argument('--test-py-test', action='store_true',
+                       default=environ.get('PYBUILD_TEST_PY_TEST') == '1',
+                       help='use py.test module in --test step')
+
     dirs = parser.add_argument_group('DIRECTORIES')
     dirs.add_argument('-d', '--dir', action='store', metavar='DIR',
                       default=getcwd(),
diff --git a/pybuild.rst b/pybuild.rst
index 3d6df38..b89a49f 100644
--- a/pybuild.rst
+++ b/pybuild.rst
@@ -52,6 +52,18 @@ ACTION
     --list-systems
         list available build systems and exit
 
+TESTS
+-----
+    unittest's discover from standard library (available in Python 2.7 and
+    >= 3.2) is used in test step by default.
+
+    --test-nose
+        use nose module in test step, remember to add python-nose and/or
+        python3-nose to Build-Depends
+    --test-pytest
+        use pytest module in test step, remember to add python-pytest and/or
+        python3-pytest to Build-Depends
+
 BUILD SYSTEM ARGUMENTS
 ----------------------
   Additional arguments passed to the build system.

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



More information about the Reproducible-builds mailing list