diff --git a/columnize-0.3.10.tar.gz b/columnize-0.3.10.tar.gz deleted file mode 100644 index ba0f65c..0000000 --- a/columnize-0.3.10.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5669984ae49447ee21dc33b6635a23827b25f4015e92c0858e1ac29f4e6cf5cc -size 9690 diff --git a/columnize-0.3.11.tar.gz b/columnize-0.3.11.tar.gz new file mode 100644 index 0000000..4fe57fc --- /dev/null +++ b/columnize-0.3.11.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a631b863b310a6c1457629b7bf32a3777ea5a407f8985311ce8c24c31d1d8bb2 +size 18776 diff --git a/drop-nose-requirement.patch b/drop-nose-requirement.patch deleted file mode 100644 index 9eec7bd..0000000 --- a/drop-nose-requirement.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- - setup.py | 2 -- - 1 file changed, 2 deletions(-) - ---- a/setup.py -+++ b/setup.py -@@ -28,12 +28,10 @@ setup( - long_description = long_description, - long_description_content_type = "text/x-rst", - name = modname, -- test_suite = 'nose.collector', - url = web, - version = VERSION, - py_modules = py_modules, - install_requires = install_requires, - tests_require = tests_require, -- setup_requires = ['nose>=1.0'], - zip_safe = zip_safe - ) diff --git a/python-columnize-no-mock.patch b/python-columnize-no-mock.patch deleted file mode 100644 index 639b7ee..0000000 --- a/python-columnize-no-mock.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- - __pkginfo__.py | 2 +- - test_columnize.py | 3 ++- - 2 files changed, 3 insertions(+), 2 deletions(-) - ---- a/__pkginfo__.py -+++ b/__pkginfo__.py -@@ -45,7 +45,7 @@ exec( - ) - ) - --tests_require = ["mock"] -+tests_require = [""] - web = "https://github.com/rocky/pycolumnize" - # tracebacks in zip files are funky and not debuggable - zip_safe = False ---- a/test_columnize.py -+++ b/test_columnize.py -@@ -1,7 +1,8 @@ - #!/usr/bin/env python - # -*- Python -*- - "Unit test for Columnize" --import mock, operator, os, sys, unittest -+import operator, os, sys, unittest -+import unittest.mock as mock - - top_builddir = os.path.join(os.path.dirname(__file__), os.path.pardir) - if top_builddir[-1] != os.path.sep: diff --git a/python-columnize.changes b/python-columnize.changes index 4c05954..ef5f2ea 100644 --- a/python-columnize.changes +++ b/python-columnize.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Sat Mar 12 09:14:09 UTC 2022 - Matej Cepl + +- Update to 0.3.11: + - store source-code module in a directory + - black files + - use pytest + - use __version__ for version number + - start using github workflows + - Bundle tests into tarball +- Remove upstreamed patches: + - drop-nose-requirement.patch + - python-columnize-no-mock.patch + - test_columnize.py + ------------------------------------------------------------------- Tue Mar 8 10:13:54 UTC 2022 - Matej Cepl diff --git a/python-columnize.spec b/python-columnize.spec index acc6347..e157033 100644 --- a/python-columnize.spec +++ b/python-columnize.spec @@ -20,21 +20,13 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-columnize -Version: 0.3.10 +Version: 0.3.11 Release: 0 License: MIT Summary: Format a simple (i.e. not nested) list into aligned columns URL: https://github.com/rocky/pycolumnize Group: Development/Languages/Python Source0: https://files.pythonhosted.org/packages/source/c/columnize/columnize-%{version}.tar.gz -# Include test file missed from being included in source tarball gh#rocky/pycolumnize#29 -# https://raw.githubusercontent.com/rocky/pycolumnize/%%{version}/test_columnize.py -Source1: test_columnize.py -# PATCH-FEATURE-OPENSUSE drop-nose-requirement.patch badshah400@gmail.com -- Drop requirement on outdated nose; we do not run tests anyway -Patch0: drop-nose-requirement.patch -# PATCH-FIX-UPSTREAM python-columnize-no-mock.patch gh#rocky/pycolumnize#28 mcepl@suse.com -# remove the need for external mock package -Patch1: python-columnize-no-mock.patch BuildRequires: %{python_module setuptools} BuildRequires: python-rpm-macros # SECTION For tests @@ -49,9 +41,7 @@ BuildArch: noarch Format a simple (i.e. not nested) list into aligned columns. %prep -%setup -q -n columnize-%{version} -cp %{SOURCE1} ./ -%autopatch -p1 +%autosetup -p1 -n columnize-%{version} %build %python_build @@ -66,8 +56,7 @@ cp %{SOURCE1} ./ %files %{python_files} %doc NEWS.md README.rst %license LICENSE -%{python_sitelib}/%{modname}.py* -%{python_sitelib}/%{modname}-%{version}-py%{python_version}.egg-info/ -%pycache_only %{python_sitelib}/__pycache__/* +%{python_sitelib}/%{modname} +%{python_sitelib}/%{modname}-%{version}*-info/ %changelog diff --git a/test_columnize.py b/test_columnize.py deleted file mode 100644 index ce466d3..0000000 --- a/test_columnize.py +++ /dev/null @@ -1,178 +0,0 @@ -#!/usr/bin/env python -# -*- Python -*- -"Unit test for Columnize" -import mock, operator, os, sys, unittest - -top_builddir = os.path.join(os.path.dirname(__file__), os.path.pardir) -if top_builddir[-1] != os.path.sep: - top_builddir += os.path.sep -sys.path.insert(0, top_builddir) - -from columnize import columnize - -class TestColumize(unittest.TestCase): - - def test_basic(self): - """Basic sanity and status testing.""" - self.assertEqual("1, 2, 3\n", - columnize(['1', '2', '3'], 10, ', ')) - self.assertEqual("1 3\n2 4\n", - columnize(['1', '2', '3', '4'], 4)) - - self.assertEqual("1 3\n2 4\n", - columnize(['1', '2', '3', '4'], 7)) - - self.assertEqual("0 1 2\n3\n", - columnize(['0', '1', '2', '3'], 7, - arrange_vertical=False)) - - self.assertEqual("\n", columnize([])) - self.assertEqual("oneitem\n", columnize(["oneitem"])) - - data = [str(i) for i in range(55)] - self.assertEqual( - "0, 6, 12, 18, 24, 30, 36, 42, 48, 54\n" + - "1, 7, 13, 19, 25, 31, 37, 43, 49\n" + - "2, 8, 14, 20, 26, 32, 38, 44, 50\n" + - "3, 9, 15, 21, 27, 33, 39, 45, 51\n" + - "4, 10, 16, 22, 28, 34, 40, 46, 52\n" + - "5, 11, 17, 23, 29, 35, 41, 47, 53\n", - columnize(data, displaywidth=39, ljust=False, - arrange_vertical=True, colsep=', ')) - - self.assertEqual( - " 0, 7, 14, 21, 28, 35, 42, 49\n" + - " 1, 8, 15, 22, 29, 36, 43, 50\n" + - " 2, 9, 16, 23, 30, 37, 44, 51\n" + - " 3, 10, 17, 24, 31, 38, 45, 52\n" + - " 4, 11, 18, 25, 32, 39, 46, 53\n" + - " 5, 12, 19, 26, 33, 40, 47, 54\n" + - " 6, 13, 20, 27, 34, 41, 48\n", - columnize(data, displaywidth=39, ljust=False, - arrange_vertical=True, colsep=', ', - lineprefix=' ')) - - self.assertEqual( - " 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\n" + - "10, 11, 12, 13, 14, 15, 16, 17, 18, 19\n" + - "20, 21, 22, 23, 24, 25, 26, 27, 28, 29\n" + - "30, 31, 32, 33, 34, 35, 36, 37, 38, 39\n" + - "40, 41, 42, 43, 44, 45, 46, 47, 48, 49\n" + - "50, 51, 52, 53, 54\n", - columnize(data, displaywidth=39, ljust=False, - arrange_vertical=False, colsep=', ')) - - self.maxDiff = None - self.assertEqual( - " 0, 1, 2, 3, 4, 5, 6, 7\n" + - " 8, 9, 10, 11, 12, 13, 14, 15\n" + - " 16, 17, 18, 19, 20, 21, 22, 23\n" + - " 24, 25, 26, 27, 28, 29, 30, 31\n" + - " 32, 33, 34, 35, 36, 37, 38, 39\n" + - " 40, 41, 42, 43, 44, 45, 46, 47\n" + - " 48, 49, 50, 51, 52, 53, 54\n", - columnize(data, displaywidth=34, ljust=False, - arrange_vertical=False, colsep=', ', - lineprefix=' ')) - - - data = ( - "one", "two", "three", - "for", "five", "six", - "seven", "eight", "nine", - "ten", "eleven", "twelve", - "thirteen", "fourteen", "fifteen", - "sixteen", "seventeen", "eightteen", - "nineteen", "twenty", "twentyone", - "twentytwo", "twentythree", "twentyfour", - "twentyfive","twentysix", "twentyseven",) - - self.assertEqual( -"one two three for five six \n" + -"seven eight nine ten eleven twelve \n" + -"thirteen fourteen fifteen sixteen seventeen eightteen \n" + -"nineteen twenty twentyone twentytwo twentythree twentyfour\n" + -"twentyfive twentysix twentyseven\n", columnize(data, arrange_vertical=False)) - - self.assertEqual( -"one five nine thirteen seventeen twentyone twentyfive \n" + -"two six ten fourteen eightteen twentytwo twentysix \n" + -"three seven eleven fifteen nineteen twentythree twentyseven\n" + -"for eight twelve sixteen twenty twentyfour \n", columnize(data)) - - self.assertEqual('0 1 2 3\n', columnize(list(range(4)))) - - self.assertEqual( -"[ 0, 1, 2, 3, 4, 5, 6, 7, 8,\n"+ -" 9, 10, 11, 12, 13, 14, 15, 16, 17,\n"+ -" 18, 19, 20, 21, 22, 23, 24, 25, 26,\n"+ -" 27, 28, 29, 30, 31, 32, 33, 34, 35,\n"+ -" 36, 37, 38, 39, 40, 41, 42, 43, 44,\n"+ -" 45, 46, 47, 48, 49, 50, 51, 52, 53,\n"+ -" 54]\n\n", columnize(list(range(55)), - opts={'displaywidth':38, 'arrange_array':True})) - - self.assertEqual("""[ 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11] - -""", columnize(list(range(12)), - opts={'displaywidth':6, 'arrange_array':True})) - - self.assertEqual("""[ 0, 1, - 2, 3, - 4, 5, - 6, 7, - 8, 9, - 10, 11] - -""", columnize(list(range(12)), - opts={'displaywidth':9, 'arrange_array':True})) - - return - - def test_colfmt(self): - self.assertEqual(' 0 1 2 3\n', - columnize([0, 1, 2, 3], 7, - arrange_vertical=False, - opts={'colfmt': '%5d'})) - - def test_lineprefix(self): - self.assertEqual('>>> 0\n>>> 1\n>>> 2\n>>> 3\n', - columnize([0, 1, 2, 3], 7, - arrange_vertical=False, - opts={'colfmt': '%5d', - 'displaywidth': 16, - 'lineprefix': '>>> '})) - - def test_lineprefix_just_wide_enough(self): - self.assertEqual('>>>10 12\n>>>11 13\n', - columnize([10, 11, 12, 13], - opts={'lineprefix': '>>>', - 'displaywidth': 9})) - - if sys.version_info[:2] >= (3, 6): - - @mock.patch.dict('os.environ', {'COLUMNS': '87'}, clear=True) - def test_computed_displaywidth_environ_COLUMNS_set(self): - from columnize import computed_displaywidth - width = computed_displaywidth() - self.assertEqual(width, 87) - - def test_errors(self): - """Test various error conditions.""" - self.assertRaises(TypeError, columnize, 5, 'reject input - not array') - return - pass - -if __name__ == '__main__': - unittest.main()