Hi,

thanks for the patch and sorry for long time it took me to take a loot
at it.

I tried to test it with python-os-testr but it FTBFS is there a better
package to test it with? Note that I added cd {build_dir} and --config
to the command line as testing source files doesn't make much sense.

diff --git a/dh/pybuild.pm b/dh/pybuild.pm
index c032644..906f383 100644
--- a/dh/pybuild.pm
+++ b/dh/pybuild.pm
@@ -141,12 +141,24 @@ sub pybuild_commands {
 				push @py2opts, '--test-pytest'}
 			elsif (grep {$_ eq 'python-nose'} @deps and $ENV{'PYBUILD_TEST_NOSE'} ne '0') {
 				push @py2opts, '--test-nose'}
+			elsif (grep {$_ eq 'python-stestr'} @deps and $ENV{'PYBUILD_TEST_STESTR'} ne '0') {
+				push @py2opts, '--test-stestr'}
+			elsif (grep {$_ eq 'python-testrepository'} @deps and $ENV{'PYBUILD_TEST_TESTR'} ne '0') {
+				push @py2opts, '--test-testr'}
+			elsif (grep {$_ eq 'python-os-testr'} @deps and $ENV{'PYBUILD_TEST_OSTESTR'} ne '0') {
+				push @py2opts, '--test-ostestr'}
 			if (grep {$_ eq 'python3-tox'} @deps and $ENV{'PYBUILD_TEST_TOX'} ne '0') {
 				push @py3opts, '--test-tox'}
 			elsif (grep {$_ eq 'python3-pytest'} @deps and $ENV{'PYBUILD_TEST_PYTEST'} ne '0') {
 				push @py3opts, '--test-pytest'}
 			elsif (grep {$_ eq 'python3-nose'} @deps and $ENV{'PYBUILD_TEST_NOSE'} ne '0') {
 				push @py3opts, '--test-nose'}
+			elsif (grep {$_ eq 'python3-stestr'} @deps and $ENV{'PYBUILD_TEST_STESTR'} ne '0') {
+				push @py3opts, '--test-stestr'}
+			elsif (grep {$_ eq 'python3-testrepository'} @deps and $ENV{'PYBUILD_TEST_TESTR'} ne '0') {
+				push @py3opts, '--test-testr'}
+			elsif (grep {$_ eq 'python3-os-testr'} @deps and $ENV{'PYBUILD_TEST_OSTESTR'} ne '0') {
+				push @py3opts, '--test-ostestr'}
 			if (grep {$_ eq 'pypy-tox'} @deps and $ENV{'PYBUILD_TEST_TOX'} ne '0') {
 				push @pypyopts, '--test-tox'}
 			elsif (grep {$_ eq 'pypy-pytest'} @deps and $ENV{'PYBUILD_TEST_PYTEST'} ne '0') {
diff --git a/dhpython/build/base.py b/dhpython/build/base.py
index b99ccad..eb675ae 100644
--- a/dhpython/build/base.py
+++ b/dhpython/build/base.py
@@ -201,7 +201,18 @@ class Base:
         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}'
+            return 'cd {build_dir}; tox -c {dir}/tox.ini -e py{version}'
+        elif self.cfg.test_stestr:
+            return ('cd {build_dir};'
+                    'python{version.major}-stestr --config {dir}/.stestr.conf init;'
+                    'PYTHON=python{version} python{version.major}-stestr --config {dir}/.stestr.conf run')
+        elif self.cfg.test_testr:
+            return ('cd {build_dir};'
+                    'testr-python{version.major} init;'
+                    'PYTHON=python{version} testr-python{version.major} run')
+        elif self.cfg.test_ostestr:
+            return ('cd {build_dir};'
+                    'PYTHON=python{version} python{version.major}-ostestr')
         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 4354183..7b19a56 100755
--- a/pybuild
+++ b/pybuild
@@ -453,6 +453,15 @@ def parse_args(argv):
     tests.add_argument('--test-tox', action='store_true',
                        default=environ.get('PYBUILD_TEST_TOX') == '1',
                        help='use tox in --test step')
+    tests.add_argument('--test-stestr', action='store_true',
+                       default=environ.get('PYBUILD_TEST_STESTR') == '1',
+                       help='use stestr in --test step')
+    tests.add_argument('--test-testr', action='store_true',
+                       default=environ.get('PYBUILD_TEST_TESTR') == '1',
+                       help='use testr in --test step')
+    tests.add_argument('--test-ostestr', action='store_true',
+                       default=environ.get('PYBUILD_TEST_OSTESTR') == '1',
+                       help='use ostestr in --test step')
 
     dirs = parser.add_argument_group('DIRECTORIES')
     dirs.add_argument('-d', '--dir', action='store', metavar='DIR',
@@ -507,6 +516,7 @@ def parse_args(argv):
         args.versions = versions
 
     if args.test_nose or args.test_pytest or args.test_tox\
+       or args.test_stestr or args.test_testr or args.test_ostestr\
        or args.system == 'custom':
         args.custom_tests = True
     else:
diff --git a/pybuild.rst b/pybuild.rst
index e5709a4..1a5eb9d 100644
--- a/pybuild.rst
+++ b/pybuild.rst
@@ -88,6 +88,15 @@ TESTS
     --test-tox
         use tox command in test step, remember to add python-tox
         to Build-Depends. Requires tox.ini file
+    --test-stestr
+        use stestr command in test step, remember to add python-stestr and/or
+        python3-stestr to Build-Depends.
+    --test-testr
+        use testr command in test step, remember to add python-testrepository
+        and/or python3-testrepository to Build-Depends.
+    --test-ostestr
+        use ostestr command in test step, remember to add python-os-testr and/or
+        python3-os-testr to Build-Depends.
 
 
 testfiles

Reply via email to