update to 1.4.0

This commit is contained in:
baizg1107 2021-09-07 10:09:36 +08:00
parent 891c048609
commit f6cdf02aa1
7 changed files with 294 additions and 161 deletions

View File

@ -0,0 +1,105 @@
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
index 17a970a..63c7d66 100644
--- a/python/subunit/__init__.py
+++ b/python/subunit/__init__.py
@@ -799,7 +799,7 @@ class TestProtocolClient(testresult.TestResult):
":param datetime: A datetime.datetime object.
"""
- time = a_datetime.astimezone(iso8601.Utc())
+ time = a_datetime.astimezone(iso8601.UTC)
self._stream.write(_b("time: %04d-%02d-%02d %02d:%02d:%02d.%06dZ\n" % (
time.year, time.month, time.day, time.hour, time.minute,
time.second, time.microsecond)))
diff --git a/python/subunit/test_results.py b/python/subunit/test_results.py
index 53c3dad..3cda44a 100644
--- a/python/subunit/test_results.py
+++ b/python/subunit/test_results.py
@@ -196,7 +196,7 @@ class AutoTimingTestResultDecorator(HookedTestResultDecorator):
time = self._time
if time is not None:
return
- time = datetime.datetime.utcnow().replace(tzinfo=iso8601.Utc())
+ time = datetime.datetime.utcnow().replace(tzinfo=iso8601.UTC)
self.decorated.time(time)
def progress(self, offset, whence):
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py
index 7427b12..7692489 100644
--- a/python/subunit/tests/test_test_protocol.py
+++ b/python/subunit/tests/test_test_protocol.py
@@ -993,7 +993,7 @@ class TestTestProtocolServerStreamTime(unittest.TestCase):
self.assertEqual(_b(""), self.stream.getvalue())
self.assertEqual([
('time', datetime.datetime(2001, 12, 12, 12, 59, 59, 0,
- iso8601.Utc()))
+ iso8601.UTC))
], self.result._events)
@@ -1368,7 +1368,7 @@ class TestTestProtocolClient(TestCase):
def test_time(self):
# Calling time() outputs a time signal immediately.
self.protocol.time(
- datetime.datetime(2009,10,11,12,13,14,15, iso8601.Utc()))
+ datetime.datetime(2009,10,11,12,13,14,15, iso8601.UTC))
self.assertEqual(
_b("time: 2009-10-11 12:13:14.000015Z\n"),
self.io.getvalue())
diff --git a/python/subunit/tests/test_test_protocol2.py b/python/subunit/tests/test_test_protocol2.py
index bbf510e..f970ed6 100644
--- a/python/subunit/tests/test_test_protocol2.py
+++ b/python/subunit/tests/test_test_protocol2.py
@@ -218,7 +218,7 @@ class TestStreamResultToBytes(TestCase):
def test_timestamp(self):
timestamp = datetime.datetime(2001, 12, 12, 12, 59, 59, 45,
- iso8601.Utc())
+ iso8601.UTC)
result, output = self._make_result()
result.status(test_id="bar", test_status='success', timestamp=timestamp)
self.assertEqual(CONSTANT_TIMESTAMP, output.getvalue())
@@ -382,7 +382,7 @@ class TestByteStreamToStreamResult(TestCase):
def test_timestamp(self):
timestamp = datetime.datetime(2001, 12, 12, 12, 59, 59, 45,
- iso8601.Utc())
+ iso8601.UTC)
self.check_event(CONSTANT_TIMESTAMP,
'success', test_id='bar', timestamp=timestamp)
diff --git a/python/subunit/tests/test_test_results.py b/python/subunit/tests/test_test_results.py
index 44f95b3..f1a83fd 100644
--- a/python/subunit/tests/test_test_results.py
+++ b/python/subunit/tests/test_test_results.py
@@ -178,7 +178,7 @@ class TestAutoTimingTestResultDecorator(unittest.TestCase):
def test_calling_time_inhibits_automatic_time(self):
# Calling time() outputs a time signal immediately and prevents
# automatically adding one when other methods are called.
- time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.Utc())
+ time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.UTC)
self.result.time(time)
self.result.startTest(self)
self.result.stopTest(self)
@@ -186,7 +186,7 @@ class TestAutoTimingTestResultDecorator(unittest.TestCase):
self.assertEqual(time, self.decorated._calls[0])
def test_calling_time_None_enables_automatic_time(self):
- time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.Utc())
+ time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.UTC)
self.result.time(time)
self.assertEqual(1, len(self.decorated._calls))
self.assertEqual(time, self.decorated._calls[0])
diff --git a/python/subunit/v2.py b/python/subunit/v2.py
index e8a31d6..c299cab 100644
--- a/python/subunit/v2.py
+++ b/python/subunit/v2.py
@@ -49,7 +49,7 @@ FLAG_TAGS = 0x0080
FLAG_MIME_TYPE = 0x0020
FLAG_EOF = 0x0010
FLAG_FILE_CONTENT = 0x0040
-EPOCH = datetime.datetime.utcfromtimestamp(0).replace(tzinfo=iso8601.Utc())
+EPOCH = datetime.datetime.utcfromtimestamp(0).replace(tzinfo=iso8601.UTC)
NUL_ELEMENT = b'\0'[0]
# Contains True for types for which 'nul in thing' falsely returns false.
_nul_test_broken = {}

Binary file not shown.

BIN
subunit-1.4.0.tar.gz Normal file

Binary file not shown.

View File

@ -1,21 +1,8 @@
From 2051f178d568a1595f497308703495b9e33ff80b Mon Sep 17 00:00:00 2001
From: Lukas Bezdicka <lbezdick@redhat.com>
Date: Wed, 2 Sep 2015 06:55:42 -0400
Subject: [PATCH] Correctly decode binary to utf8 string
This patch solves error:
Expecting a string b'2014-12-16 20:42:25.441886Z'
Related-Bug: #1403214
---
python/subunit/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
index 7d864e8..b198884 100644
index 63c7d66..e735437 100644
--- a/python/subunit/__init__.py
+++ b/python/subunit/__init__.py
@@ -556,7 +556,7 @@ def _handleTags(self, offset, line):
@@ -556,7 +556,7 @@ class TestProtocolServer(object):
def _handleTime(self, offset, line):
# Accept it, but do not do anything with it yet.
try:

View File

@ -1,5 +1,5 @@
--- a/COPYING.orig 2018-03-24 08:22:44.000000000 -0600
+++ b/COPYING 2018-07-03 15:07:50.241733503 -0600
--- COPYING.orig 2018-03-24 08:22:44.000000000 -0600
+++ COPYING 2018-07-03 15:07:50.241733503 -0600
@@ -29,8 +29,6 @@ Code that has been incorporated into Sub
naturally be under its own license, and will retain that license.
@ -9,8 +9,8 @@
* The runtests.py and python/subunit/tests/TestUtil.py module are GPL test
support modules. They are not installed by Subunit - they are only ever
used on the build machine. Copyright 2004 Canonical Limited.
--- a/Makefile.am.orig 2018-03-24 08:22:44.000000000 -0600
+++ b/Makefile.am 2018-07-03 15:08:08.386499408 -0600
--- Makefile.am.orig 2018-03-24 08:22:44.000000000 -0600
+++ Makefile.am 2018-07-03 15:08:08.386499408 -0600
@@ -16,11 +16,6 @@ EXTRA_DIST = \
perl/lib/Subunit.pm \
perl/lib/Subunit/Diff.pm \
@ -31,8 +31,8 @@
python/subunit/progress_model.py \
python/subunit/run.py \
python/subunit/v2.py \
--- a/README.rst.orig 2018-03-24 08:22:44.000000000 -0600
+++ b/README.rst 2018-07-03 15:08:21.114335195 -0600
--- README.rst.orig 2018-03-24 08:22:44.000000000 -0600
+++ README.rst 2018-07-03 15:08:21.114335195 -0600
@@ -15,9 +15,6 @@
See the COPYING file for full details on the licensing of Subunit.

View File

@ -1,190 +1,220 @@
Name: subunit
Version: 1.3.0
Release: 4
Summary: C and C++ bindings for subunit
License: Apache-2.0
URL: https://launchpad.net/%{name}
Source0: https://launchpad.net/%{name}/trunk/1.3/+download/%{name}-%{version}.tar.gz
Patch0000: subunit-unbundle-iso8601.patch
Patch0001: subunit-decode-binary-to-unicode.patch
BuildRequires: check-devel cppunit-devel gcc-c++ libtool perl-generators perl(ExtUtils::MakeMaker)
BuildRequires: pkgconfig python2-devel python2-hypothesis python2-docutils python2-extras python2-fixtures
BuildRequires: python2-iso8601 python2-setuptools python2-testscenarios python2-testtools >= 1.8.0
BuildRequires: python3-devel python3-docutils python3-extras python3-fixtures python3-iso8601
BuildRequires: python3-hypothesis python3-setuptools python3-testscenarios python3-testtools >= 1.8.0
Provides: subunit-cppunit = %{version}-%{release}
Obsoletes: subunit-cppunit < %{version}-%{release}
%define _unpackaged_files_terminate_build 0
Name: subunit
Version: 1.4.0
Release: 1
Summary: C bindings for subunit
License: ASL 2.0 or BSD
URL: https://launchpad.net/subunit
Source0: https://github.com/testing-cabal/subunit/archive/%{version}/%{name}-%{version}.tar.gz
Patch0: %{name}-unbundle-iso8601.patch
Patch1: %{name}-decode-binary-to-unicode.patch
Patch2: 0001-port-to-python-iso8601-0.1.14.patch
BuildRequires: check-devel cppunit-devel gcc-c++ libtool perl-generators make
BuildRequires: perl(ExtUtils::MakeMaker) pkgconfig
BuildRequires: python3-devel python3-docutils python3-extras python3-fixtures python3-iso8601
BuildRequires: python3-hypothesis python3-setuptools python3-testscenarios
BuildRequires: python3-testtools >= 1.8.0
%description
Subunit C and C++ bindings. See the python-subunit package for test processing
Subunit C bindings. See the python-subunit package for test processing
functionality.
%package devel
Summary: Header files for developing C and C++ applications that use subunit
Requires: %{name} = %{version}-%{release}
Requires: cppunit-devel%{?_isa}
Provides: subunit-static = %{version}-%{release} subunit-cppunit-devel = %{version}-%{release}
Obsoletes: subunit-static < %{version}-%{release} subunit-cppunit-devel < %{version}-%{release}
Summary: Header files for developing C applications that use subunit
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
Header files and libraries for developing C and C++ applications that use subunit.
Header files and libraries for developing C applications that use subunit.
%package cppunit
Summary: Subunit integration into cppunit
Requires: %{name}%{?_isa} = %{version}-%{release}
%description cppunit
Subunit integration into cppunit.
%package cppunit-devel
Summary: Header files for applications that use cppunit and subunit
Requires: %{name}-cppunit%{?_isa} = %{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{version}-%{release} cppunit-devel%{?_isa}
%description cppunit-devel
Header files and libraries for developing applications that use cppunit
and subunit.
%package perl
Summary: Perl bindings for subunit
BuildArch: noarch
Requires: perl(:MODULE_COMPAT_%{perl_version})
Summary: Perl bindings for subunit
BuildArch: noarch
Requires: perl(:MODULE_COMPAT_%{perl_version})
%description perl
Perl bindings for subunit. Log in to the relevant website for details.
Subunit perl bindings. See the python-subunit package for test
processing functionality.
%package shell
Summary: Shell bindings for subunit
BuildArch: noarch
Summary: Shell bindings for subunit
BuildArch: noarch
%description shell
Shell bindings for subunit. Log in to the relevant website for details.
%package -n python2-%{name}
Summary: Streaming protocol and Command line filters
BuildArch: noarch
Requires: python2-extras python2-iso8601 python2-testtools >= 1.8.0
Requires: pygtk2 python2-junitxml
Provides: subunit-filters = %{version}-%{release}
Obsoletes: subunit-filters < %{version}-%{release}
%{?python_provide:%python_provide python2-%{name}}
%description -n python2-%{name}
Subunit is a streaming protocol for test results. The package provides two functions,
one function is that streaming protocol for test results, another is that command line
filters for processing subunit streams. Log in to the relevant website for details.
Subunit shell bindings. See the python-subunit package for test
processing functionality.
%package -n python3-%{name}
Summary: Streaming protocol for python3 test results
BuildArch: noarch
Requires: python3-extras python3-iso8601 python3-testtools >= 1.8.0
Summary: Streaming protocol for test results
BuildArch: noarch
Requires: python3-extras python3-iso8601 python3-testtools >= 1.8.0
%{?python_provide:%python_provide python3-%{name}}
%description -n python3-%{name}
Subunit is a streaming protocol for test results. The protocol is a
binary encoding that is easily generated and parsed. Log in to the
relevant website for details.
binary encoding that is easily generated and parsed. By design all the
components of the protocol conceptually fit into the xUnit TestCase ->
TestResult interaction.
Subunit comes with command line filters to process a subunit stream and
language bindings for python, C, C++ and shell. Bindings are easy to
write for other languages.
A number of useful things can be done easily with subunit:
- Test aggregation: Tests run separately can be combined and then
reported/displayed together. For instance, tests from different
languages can be shown as a seamless whole.
- Test archiving: A test run may be recorded and replayed later.
- Test isolation: Tests that may crash or otherwise interact badly with
each other can be run separately and then aggregated, rather than
interfering with each other.
- Grid testing: subunit can act as the necessary serialization and
deserialization to get test runs on distributed machines to be
reported in real time.
%package -n python3-%{name}-test
Summary: Test code for the python 3 subunit bindings
BuildArch: noarch
Requires: python3-%{name} = %{version}-%{release} %{name}-filters = %{version}-%{release}
%{?python_provide:%python_provide python3-%{name}-test}
Obsoletes: python3-%{name}-test < 1.3.0-9
Provides: python3-%{name}-test = %{version}-%{release}
%description -n python3-%{name}-test
%{summary}.
%package filters
Summary: Command line filters for processing subunit streams
BuildArch: noarch
Requires: python3-%{name} = %{version}-%{release} python3-gobject gtk3 >= 3.20
Requires: libnotify >= 0.7.7 python3-junitxml
%description filters
Command line filters for processing subunit streams.
%package static
Summary: Static C library for subunit
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%description static
Subunit C bindings in a static library, for building statically linked
test cases.
%prep
%autosetup -c -p1
sed -i '447,$d' python/subunit/tests/test_test_protocol2.py
%autosetup -n %{name}-%{version} -S git
fixtimestamp() {
touch -r $1.orig $1
rm $1.orig
}
for filt in filters/*; do
sed -i 's,/usr/bin/env ,/usr/bin/,' $filt
chmod 0755 $filt
sed 's,/usr/bin/env ,/usr/bin/,' $filt > ${filt}.new
sed -i 's,\(%{_bindir}/python\),\13,' ${filt}.new
chmod 0755 ${filt}.new
touch -r $filt ${filt}.new
mv -f ${filt}.new $filt
done
sed "/^tests_LDADD/ilibcppunit_subunit_la_LIBADD = -lcppunit libsubunit.la\n" -i Makefile.am
sed -i 's,%{_bindir}/python,&2,' python/subunit/run.py
for file in $(grep -Frl "%{_bindir}/env python"); do
sed -i 's,%{_bindir}/env python,%{_bindir}/python2,' $file
sed "/^tests_LDADD/ilibcppunit_subunit_la_LIBADD = -lcppunit libsubunit.la\n" \
-i Makefile.am
for fil in $(grep -Frl "%{_bindir}/env python"); do
sed -i.orig 's,%{_bindir}/env python,%{_bindir}/python2,' $fil
fixtimestamp $fil
done
ln -fs %{python2_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py
autoreconf -fi
cp -a ../%{name}-%{version} ../python3
mv ../python3 .
cd python3/
for file in $(grep -Frl "%{_bindir}/python2"); do
sed -i 's,\(%{_bindir}/python\)2,\13,' $file
pushd python3
for fil in $(grep -Frl "%{_bindir}/python2"); do
sed -i.orig 's,\(%{_bindir}/python\)2,\13,' $fil
fixtimestamp $fil
done
ln -fs %{python3_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py
cd ..
ln -f -s %{python3_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py
popd
%build
export INSTALLDIRS=perl
%configure
sed -i 's/^hardcode_libdir_flag_spec=.*/hardcode_libdir_flag_spec=""/gi;
s/^runpath_var=LD_RUN_PATH/runpath_var=DIE_RPATH_DIE/g;s/CC=.g../& -Wl,--as-needed/' libtool
%make_build
%py2_build
cd python3/
%configure --enable-shared --enable-static
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
-e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
-e 's|CC=.g..|& -Wl,--as-needed|' \
-i libtool
make %{?_smp_mflags}
pushd python3
export INSTALLDIRS=perl
export PYTHON=%{_bindir}/python3
%configure
sed -i 's/^hardcode_libdir_flag_spec=.*/hardcode_libdir_flag_spec=""/g;
s/^runpath_var=LD_RUN_PATH/runpath_var=DIE_RPATH_DIE/g; s/CC=.g../& -Wl,--as-needed/' libtool
%make_build
%configure --enable-shared --enable-static
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
-e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
-e 's|CC=.g..|& -Wl,--as-needed|' \
-i libtool
make %{?_smp_mflags}
%py3_build
cd ../
popd
%install
cd python3/
pushd python3
%py3_install
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/run.py
ln -fs %{python3_sitelib}/iso8601/iso8601.py \
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-script.py
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-two-script.py
sed -i "s|root, 'filters'|'/usr', 'bin'|" \
%{buildroot}%{python3_sitelib}/%{name}/tests/test_subunit_filter.py
ln -f -s %{python3_sitelib}/iso8601/iso8601.py \
%{buildroot}%{python3_sitelib}/subunit/iso8601.py
for file in iso8601.cpython-37.opt-1.pyc iso8601.cpython-37.pyc; do
ln -fs %{python3_sitelib}/iso8601/__pycache__/$file \
%{buildroot}%{python3_sitelib}/subunit/__pycache__/$file
for fil in iso8601.cpython-37.opt-1.pyc iso8601.cpython-37.pyc; do
ln -f -s %{python3_sitelib}/iso8601/__pycache__/$fil \
%{buildroot}%{python3_sitelib}/subunit/__pycache__/$fil
done
cd ..
%make_install
%py2_install
for file in iso8601.py iso8601.pyc iso8601.pyo; do
ln -fs %{python2_sitelib}/iso8601/$file %{buildroot}%{python2_sitelib}/subunit/$file
done
install -d %{buildroot}%{_sysconfdir}/profile.d
popd
%make_install INSTALL="%{_bindir}/install -p"
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
cp -p shell/share/%{name}.sh %{buildroot}%{_sysconfdir}/profile.d
%delete_la
install -d %{buildroot}%{perl_vendorlib}
rm -f %{buildroot}%{_libdir}/*.la
mkdir -p %{buildroot}%{perl_vendorlib}
mv %{buildroot}%{perl_privlib}/Subunit* %{buildroot}%{perl_vendorlib}
rm -rf %{buildroot}%{perl_archlib}
chmod 0755 %{buildroot}%{python2_sitelib}/%{name}/run.py %{buildroot}%{_bindir}/subunit-diff
rm -fr %{buildroot}%{perl_archlib}
chmod 0755 %{buildroot}%{_bindir}/subunit-diff
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-script.py
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-two-script.py
touch -r c/include/%{name}/child.h %{buildroot}%{_includedir}/%{name}/child.h
touch -r c++/SubunitTestProgressListener.h \
%{buildroot}%{_includedir}/%{name}/SubunitTestProgressListener.h
touch -r perl/subunit-diff %{buildroot}%{_bindir}/subunit-diff
for fil in filters/*; do
touch -r $fil %{buildroot}%{_bindir}/$(basename $fil)
done
%check
export LD_LIBRARY_PATH=$PWD/.libs
export PYTHONPATH=$PWD/python/subunit:$PWD/python/subunit/tests
make check
PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} -c "import subunit.iso8601"
cd python3/
pushd python3
export PYTHON=%{__python3}
make check
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -c "import subunit.iso8601"
cd ../
popd
%ldconfig_scriptlets
%ldconfig_scriptlets cppunit
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%doc NEWS README.rst
%license Apache-2.0 BSD COPYING
%{_libdir}/lib%{name}.so.*
%{_libdir}/libcppunit_%{name}.so.*
%files devel
%doc c/README c++/README
%doc c/README
%dir %{_includedir}/%{name}/
%{_includedir}/%{name}/child.h
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/lib*.pc
%{_libdir}/*.a
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/lib%{name}.pc
%files cppunit
%{_libdir}/libcppunit_%{name}.so.*
%files cppunit-devel
%doc c++/README
%{_includedir}/%{name}/SubunitTestProgressListener.h
%{_libdir}/libcppunit_%{name}.so
%{_libdir}/pkgconfig/libcppunit_%{name}.pc
%files perl
%license Apache-2.0 BSD COPYING
@ -196,19 +226,26 @@ cd ../
%license Apache-2.0 BSD COPYING
%config(noreplace) %{_sysconfdir}/profile.d/%{name}.sh
%files -n python2-%{name}
%license Apache-2.0 BSD COPYING
%{_bindir}/*
%{python2_sitelib}/%{name}/
%{python2_sitelib}/python_%{name}-%{version}-*.egg-info
%exclude %{_bindir}/%{name}-diff
%files -n python3-%{name}
%license Apache-2.0 BSD COPYING
%{python3_sitelib}/%{name}/
%{python3_sitelib}/python_%{name}-%{version}-*.egg-info
%exclude %{python3_sitelib}/%{name}/tests/
%files -n python3-%{name}-test
%{python3_sitelib}/%{name}/tests/
%files static
%{_libdir}/*.a
%files filters
%{_bindir}/*
%exclude %{_bindir}/%{name}-diff
%changelog
* Tue Sep 7 2021 baizhonggui <baizhonggui@huawei.com> - 1.4.0-1
- Upgrade to 1.4.0
* Fri Dec 4 2020 Ge Wang <wangge20@huawei.com> - 1.3.0-4
- Fix test case to solve check failure

4
subunit.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: testing-cabal/subunit
tag_prefix: ^
separator: .