Add DEP-8 execution of tests, fixup py3 compatibility
This commit is contained in:
parent
6a846ea968
commit
27abaea1ea
3
debian/control
vendored
3
debian/control
vendored
@ -18,10 +18,12 @@ Build-Depends-Indep: python-babel (>= 1.3),
|
||||
python-hacking,
|
||||
python-oslosphinx (>= 2.2.0),
|
||||
python-oslotest (>= 1.2.0),
|
||||
python-six (>= 1.9.0),
|
||||
python-testscenarios (>= 0.4),
|
||||
python-testtools (>= 0.9.36),
|
||||
python3-babel (>= 1.3),
|
||||
python3-oslotest (>= 1.2.0),
|
||||
python3-six (>= 1.9.0),
|
||||
python3-testscenarios (>= 0.4),
|
||||
python3-testtools (>= 0.9.36),
|
||||
subunit (>= 0.0.18),
|
||||
@ -30,6 +32,7 @@ Standards-Version: 3.9.6
|
||||
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=openstack/python-os-testr.git
|
||||
Vcs-Git: git://anonscm.debian.org/openstack/python-os-testr.git
|
||||
Homepage: http://github.com/openstack/os-testr
|
||||
XS-Testsuite: autopkgtest
|
||||
|
||||
Package: python-os-testr
|
||||
Architecture: all
|
||||
|
51
debian/patches/py3-compat.patch
vendored
Normal file
51
debian/patches/py3-compat.patch
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
From 4292155e3e546064d10d56a5a0cd1dedc7eb25bd Mon Sep 17 00:00:00 2001
|
||||
From: James Page <james.page@ubuntu.com>
|
||||
Date: Tue, 23 Jun 2015 09:47:44 +0100
|
||||
Subject: [PATCH] Misc Python 3 compatibility fixes
|
||||
|
||||
Python 3 renames StringIO -> io. Use six to deal
|
||||
with this change.
|
||||
|
||||
Introduces new test dependency on six for StringIO.
|
||||
|
||||
Change-Id: Ia875b7fcbb976599053970ef79ed3f3474626bad
|
||||
---
|
||||
os_testr/tests/test_return_codes.py | 6 +++---
|
||||
test-requirements.txt | 1 +
|
||||
2 files changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/os_testr/tests/test_return_codes.py
|
||||
+++ b/os_testr/tests/test_return_codes.py
|
||||
@@ -14,13 +14,13 @@
|
||||
|
||||
import os
|
||||
import shutil
|
||||
-import StringIO
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
import testtools
|
||||
|
||||
from os_testr.tests import base
|
||||
+from six import StringIO
|
||||
|
||||
DEVNULL = open(os.devnull, 'wb')
|
||||
|
||||
@@ -47,8 +47,8 @@ class TestReturnCodes(base.TestCase):
|
||||
shutil.copy('os_testr/tests/files/setup.cfg', self.setup_cfg_file)
|
||||
shutil.copy('os_testr/tests/files/__init__.py', self.init_file)
|
||||
|
||||
- self.stdout = StringIO.StringIO()
|
||||
- self.stderr = StringIO.StringIO()
|
||||
+ self.stdout = StringIO()
|
||||
+ self.stderr = StringIO()
|
||||
# Change directory, run wrapper and check result
|
||||
self.addCleanup(os.chdir, os.path.abspath(os.curdir))
|
||||
os.chdir(self.directory)
|
||||
--- a/test-requirements.txt
|
||||
+++ b/test-requirements.txt
|
||||
@@ -10,3 +10,4 @@ sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
|
||||
oslosphinx>=2.2.0 # Apache-2.0
|
||||
oslotest>=1.2.0 # Apache-2.0
|
||||
testscenarios>=0.4
|
||||
+six>=1.9.0
|
1
debian/patches/series
vendored
Normal file
1
debian/patches/series
vendored
Normal file
@ -0,0 +1 @@
|
||||
py3-compat.patch
|
17
debian/rules
vendored
17
debian/rules
vendored
@ -26,23 +26,6 @@ override_dh_install:
|
||||
mv $(CURDIR)/debian/python-os-testr/usr/bin/subunit2html $(CURDIR)/debian/python-os-testr/usr/bin/python2-subunit2html
|
||||
mv $(CURDIR)/debian/python3-os-testr/usr/bin/subunit2html $(CURDIR)/debian/python3-os-testr/usr/bin/python3-subunit2html
|
||||
|
||||
override_dh_auto_test:
|
||||
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
|
||||
# @echo "===> Running tests"
|
||||
# set -e ; set -x ; for i in $(PYTHONS) $(PYTHON3S); do \
|
||||
# PYMAJOR=`echo $$i | cut -d'.' -f1` ; \
|
||||
# echo "===> Testing with python$$i (python$$PYMAJOR)" ; \
|
||||
# rm -rf .testrepository ; \
|
||||
# testr-python$$PYMAJOR init ; \
|
||||
# TEMP_REZ=`mktemp -t` ; \
|
||||
# PYTHONPATH=$(CURDIR) PYTHON=python$$i testr-python$$PYMAJOR run --subunit | tee $$TEMP_REZ | subunit2pyunit ; \
|
||||
# cat $$TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats ; \
|
||||
# rm -f $$TEMP_REZ ; \
|
||||
# testr-python$$PYMAJOR slowest ; \
|
||||
# done
|
||||
:
|
||||
endif
|
||||
|
||||
override_dh_sphinxdoc:
|
||||
sphinx-build -b html doc/source debian/python-os-testr-doc/usr/share/doc/python-os-testr-doc/html
|
||||
dh_sphinxdoc -O--buildsystem=python_distutils
|
||||
|
3
debian/tests/control
vendored
Normal file
3
debian/tests/control
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
Tests: unittests
|
||||
Depends: @, @builddeps@
|
||||
Restrictions: allow-stderr needs-root
|
23
debian/tests/unittests
vendored
Normal file
23
debian/tests/unittests
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
PYTHONS=$(pyversions -vr)
|
||||
PYTHON3S=$(py3versions -vr)
|
||||
|
||||
BINARIES="ostestr subunit-trace subunit2html"
|
||||
|
||||
set -e
|
||||
echo "===> Running tests"
|
||||
for i in ${PYTHONS} ${PYTHON3S}; do
|
||||
PYMAJOR=`echo $i | cut -d'.' -f1`
|
||||
echo "===> Testing with python$i (python$PYMAJOR)"
|
||||
for bin in $BINARIES; do
|
||||
update-alternatives --set $bin /usr/bin/python$PYMAJOR-$bin
|
||||
done
|
||||
rm -rf .testrepository
|
||||
testr-python$PYMAJOR init
|
||||
TEMP_REZ=`mktemp -t`
|
||||
PYTHONPATH=`pwd` PYTHON=python$i testr-python$PYMAJOR run --subunit | tee $TEMP_REZ | subunit2pyunit ; \
|
||||
cat $TEMP_REZ | subunit-filter -s --no-passthrough | subunit-stats ; \
|
||||
rm -f $TEMP_REZ ; \
|
||||
testr-python$PYMAJOR slowest ; \
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user