commit 469e101a814ce5cb7520c5953fcb441494191119 Author: tubalu Date: Thu Nov 28 15:14:48 2019 +0800 package init diff --git a/python-unittest2.spec b/python-unittest2.spec new file mode 100644 index 0000000..d756176 --- /dev/null +++ b/python-unittest2.spec @@ -0,0 +1,80 @@ +Name: python-unittest2 +Version: 1.1.0 +Release: 16 +Summary: New features added to the unittest testing framework in Python 2.7 and onwards +License: BSD +URL: http://pypi.python.org/pypi/unittest2 +Source0: https://pypi.python.org/packages/source/u/unittest2/unittest2-%{version}.tar.gz + +Patch0000: unittest2-1.1.0-remove-argparse-from-requires.patch +Patch0001: unittest2-1.1.0-backport-tests-from-py3.5.patch +BuildArch: noarch + +%description +unittest2 is a backport of the new features added to +the unittest testing framework in Python 2.7 and onwards. +It is tested to run on Python 2.6, 2.7, 3.2, 3.3, 3.4 and pypy. + +%package -n python2-unittest2 +Summary: New features added to the unittest testing framework in Python 2.7 and onwards +%{?python_provide:%python_provide python2-unittest2} +BuildRequires: python2-devel python2-setuptools python2-six python2-traceback2 +Requires: python2-traceback2 python2-setuptools python2-six + +%description -n python2-unittest2 +unittest2 is a backport of the new features added to +the unittest testing framework in Python 2.7 and onwards. +It is tested to run on Python 2.6, 2.7, 3.2, 3.3, 3.4 and pypy. + +%package -n python3-unittest2 +Summary: New features added to the unittest testing framework in Python 2.7 and onwards +%{?python_provide:%python_provide python3-unittest2} +BuildRequires: python3-devel python3-setuptools python3-six python3-traceback2 +Requires: python3-setuptools python3-six python3-traceback2 + +%description -n python3-unittest2 +unittest2 is a backport of the new features added to +the unittest testing framework in Python 2.7 and onwards. +It is tested to run on Python 2.6, 2.7, 3.2, 3.3, 3.4 and pypy. + +%prep +%autosetup -n unittest2-%{version} -p1 +rm -rf unittest2.egg-info + +%build +%py2_build +%py3_build + +%install +%py3_install +cd %{buildroot}%{_bindir} +mv unit2 unit2-%{python3_version} +ln -s unit2-%{python3_version} unit2-3 +ln -s unit2-%{python3_version} python3-unit2 +cd - + +%py2_install +cd %{buildroot}%{_bindir} +mv unit2 unit2-%{python2_version} +ln -s unit2-%{python2_version} unit2-2 +ln -s unit2-2 unit2 +cd - + +%check +%{__python2} -m unittest2 +%{__python3} -m unittest2 + +%files -n python2-unittest2 +%doc README.txt +%{_bindir}/unit2* +%{python2_sitelib}/unittest2* + +%files -n python3-unittest2 +%doc README.txt +%{_bindir}/unit2-* +%{_bindir}/python3-unit2 +%{python3_sitelib}/unittest2* + +%changelog +* Wed Nov 20 2019 openEuler Buildteam - 1.1.0-16 +- Package init diff --git a/unittest2-1.1.0-backport-tests-from-py3.5.patch b/unittest2-1.1.0-backport-tests-from-py3.5.patch new file mode 100644 index 0000000..74da922 --- /dev/null +++ b/unittest2-1.1.0-backport-tests-from-py3.5.patch @@ -0,0 +1,45 @@ +--- unittest2/test/test_loader.py.orig 2015-11-15 09:26:43.752421511 +0100 ++++ unittest2/test/test_loader.py 2015-11-15 11:02:43.944233784 +0100 +@@ -512,10 +512,20 @@ + def test_loadTestsFromName__relative_malformed_name(self): + loader = unittest.TestLoader() + ++ # XXX Should this raise AttributeError or ValueError? + suite = loader.loadTestsFromName('abc () //', unittest) + error, test = self.check_deferred_error(loader, suite) +- self.check_module_lookup_error( +- error, test, 'unittest2', 'abc () //', 'abc \(\) //') ++ if sys.version_info[:2] < (3, 5): ++ expected = "'module' object has no attribute 'abc () //'" ++ expected_regex = "'module' object has no attribute 'abc \(\) //'" ++ else: ++ expected = "module 'unittest2' has no attribute 'abc () //'" ++ expected_regex = "module 'unittest2' has no attribute 'abc \(\) //'" ++ self.assertIn( ++ expected, error, ++ 'missing error string in %r' % error) ++ self.assertRaisesRegex( ++ AttributeError, expected_regex, getattr(test, 'abc () //')) + + # "The method optionally resolves name relative to the given module" + # +@@ -924,8 +934,17 @@ + # XXX Should this raise AttributeError or ValueError? + suite = loader.loadTestsFromNames(['abc () //'], unittest) + error, test = self.check_deferred_error(loader, list(suite)[0]) +- self.check_module_lookup_error( +- error, test, 'unittest2', 'abc () //', 'abc \(\) //') ++ if sys.version_info[:2] < (3, 5): ++ expected = "'module' object has no attribute 'abc () //'" ++ expected_regex = "'module' object has no attribute 'abc \(\) //'" ++ else: ++ expected = "module 'unittest2' has no attribute 'abc () //'" ++ expected_regex = "module 'unittest2' has no attribute 'abc \(\) //'" ++ self.assertIn( ++ expected, error, ++ 'missing error string in %r' % error) ++ self.assertRaisesRegex( ++ AttributeError, expected_regex, getattr(test, 'abc () //')) + + # "The method optionally resolves name relative to the given module" + # diff --git a/unittest2-1.1.0-remove-argparse-from-requires.patch b/unittest2-1.1.0-remove-argparse-from-requires.patch new file mode 100644 index 0000000..295ce67 --- /dev/null +++ b/unittest2-1.1.0-remove-argparse-from-requires.patch @@ -0,0 +1,11 @@ +--- setup.py.orig 2015-11-12 15:51:35.557779728 +0100 ++++ setup.py 2015-11-12 15:58:04.618948793 +0100 +@@ -57,7 +57,7 @@ + # Both install and setup requires - because we read VERSION from within the + # package, and the package also exports all the APIs. + # six for compat helpers +-REQUIRES = ['argparse', 'six>=1.4', 'traceback2'], ++REQUIRES = ['six>=1.4', 'traceback2'], + + params = dict( + name=NAME, diff --git a/unittest2-1.1.0.tar.gz b/unittest2-1.1.0.tar.gz new file mode 100644 index 0000000..ec686eb Binary files /dev/null and b/unittest2-1.1.0.tar.gz differ