From 176f8b3d7a66ec3d7be4b96d1616d10efd8d7569c714f303689f7d4f7e062d0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Thu, 21 Feb 2019 11:50:16 +0000 Subject: [PATCH] Accepting request 677851 from home:jayvdb:django - Update to v2.1.0 - Activate test suite - Use single spec format for Python 2 & 3 rpms - Adds patch pr_133.patch for Python 3 support, and py37-async-keyword.patch for Python 3.7 support. OBS-URL: https://build.opensuse.org/request/show/677851 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyVows?expand=0&rev=1 --- .gitattributes | 23 +++ .gitignore | 1 + pr_133.patch | 399 +++++++++++++++++++++++++++++++++++++++ py37-async-keyword.patch | 42 +++++ pyVows-2.1.0.tar.gz | 3 + python-pyVows.changes | 14 ++ python-pyVows.spec | 70 +++++++ 7 files changed, 552 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 pr_133.patch create mode 100644 py37-async-keyword.patch create mode 100644 pyVows-2.1.0.tar.gz create mode 100644 python-pyVows.changes create mode 100644 python-pyVows.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/pr_133.patch b/pr_133.patch new file mode 100644 index 0000000..ae25abf --- /dev/null +++ b/pr_133.patch @@ -0,0 +1,399 @@ +From 9ce9ef9c67122e0a58988eef9efe218b03367345 Mon Sep 17 00:00:00 2001 +From: David Halls +Date: Thu, 19 Oct 2017 22:07:21 +0100 +Subject: [PATCH 1/4] Fixes for Python 3 + +--- + .gitignore | 3 ++ + .travis.yml | 38 ++++--------------------- + Makefile | 11 +++---- + REQUIREMENTS | 3 -- + pyvows/reporting/common.py | 10 ++++--- + pyvows/reporting/test.py | 5 +++- + pyvows/runner/abc.py | 2 +- + pyvows/runner/executionplan.py | 9 +++--- + pyvows/runner/gevent.py | 30 ++++++++++--------- + requirements-travis.txt | 4 --- + setup.py | 4 +-- + tests/assertions/like_vows.py | 4 +-- + tests/assertions/types/file_vows.py | 4 ++- + tests/bugs/64_vows.py | 5 +++- + tests/context_inheritance_vows.py | 8 ++++-- + tests/prune_execution_vows.py | 2 +- + tests/reporting/error_reporting_vows.py | 5 +++- + tests/reporting/xunit_reporter_vows.py | 6 ++-- + tests/skipping_vows.py | 10 +++++-- + 19 files changed, 76 insertions(+), 87 deletions(-) + delete mode 100644 REQUIREMENTS + delete mode 100644 requirements-travis.txt + +diff --git a/pyvows/reporting/common.py b/pyvows/reporting/common.py +index 94f4448..c6c1ed7 100644 +--- a/pyvows/reporting/common.py ++++ b/pyvows/reporting/common.py +@@ -42,10 +42,10 @@ def ensure_encoded(thing, encoding='utf-8'): + Currently used only for characters `✓` and `✗`. + + ''' +- if isinstance(thing, unicode): +- return thing.encode(encoding) +- else: ++ if isinstance(thing, bytes) or not isinstance(thing, str): + return thing ++ else: ++ return thing.encode(encoding) + + + class VowsReporter(object): +@@ -169,8 +169,10 @@ def print_traceback(self, err_type, err_obj, err_traceback, file=sys.stdout): + '''Prints a color-formatted traceback with appropriate indentation.''' + if isinstance(err_obj, AssertionError): + error_msg = err_obj ++ elif isinstance(err_obj, bytes): ++ error_msg = err_obj.decode('utf8') + else: +- error_msg = unicode(err_obj) ++ error_msg = err_obj + + print(self.indent_msg(red(error_msg)), file=file) + +diff --git a/pyvows/reporting/test.py b/pyvows/reporting/test.py +index 32e2642..6e63172 100644 +--- a/pyvows/reporting/test.py ++++ b/pyvows/reporting/test.py +@@ -11,7 +11,10 @@ + from __future__ import division, print_function + + import sys +-from StringIO import StringIO ++try: ++ from StringIO import StringIO ++except: ++ from io import StringIO + + from pyvows.color import yellow, red, blue + from pyvows.reporting.common import ( +diff --git a/pyvows/runner/abc.py b/pyvows/runner/abc.py +index 3db72eb..6ded6fa 100644 +--- a/pyvows/runner/abc.py ++++ b/pyvows/runner/abc.py +@@ -67,7 +67,7 @@ def run_vow(self, tests_collection, topic, ctx_obj, vow, vow_name, enumerated): + vow_result['succeeded'] = True + if self.on_vow_success: + self.on_vow_success(vow_result) +- except SkipTest, se: ++ except SkipTest as se: + vow_result['skip'] = se + except: + err_type, err_value, err_traceback = sys.exc_info() +diff --git a/pyvows/runner/executionplan.py b/pyvows/runner/executionplan.py +index 3b344a0..65fc82a 100644 +--- a/pyvows/runner/executionplan.py ++++ b/pyvows/runner/executionplan.py +@@ -15,7 +15,7 @@ def __init__(self, suites, exclusion_patterns, inclusion_patterns): + + def plan(self): + plan = {} +- for suiteName, contextClasses in self.suites.iteritems(): ++ for suiteName, contextClasses in self.suites.items(): + plan[suiteName] = { + 'contexts': {} + } +@@ -63,9 +63,10 @@ def plan_context(self, contextClass, idBase): + ] + + context['vows'] = [ +- name for name, vow in contextMembers if inspect.ismethod(vow) +- and self.is_included(context['id'] + '.' + name) +- and not self.is_excluded(name) ++ name for name, vow in contextMembers ++ if (inspect.ismethod(vow) or inspect.isfunction(vow)) ++ and self.is_included(context['id'] + '.' + name) ++ and not self.is_excluded(name) + ] + + subcontexts = [ +diff --git a/pyvows/runner/gevent.py b/pyvows/runner/gevent.py +index 4314225..9fb869e 100644 +--- a/pyvows/runner/gevent.py ++++ b/pyvows/runner/gevent.py +@@ -14,7 +14,10 @@ + import inspect + import sys + import time +-import StringIO ++try: ++ from StringIO import StringIO ++except: ++ from io import StringIO + try: + from colorama.ansitowin32 import AnsiToWin32 + except ImportError: +@@ -36,8 +39,8 @@ def AnsiToWin32(*args, **kwargs): + + class _LocalOutput(gevent.local.local): + def __init__(self): +- self.__dict__['stdout'] = StringIO.StringIO() +- self.__dict__['stderr'] = StringIO.StringIO() ++ self.__dict__['stdout'] = StringIO() ++ self.__dict__['stderr'] = StringIO() + + + class _StreamCapture(object): +@@ -71,9 +74,9 @@ def run(self): + start_time = time.time() + result = VowsResult() + if self.capture_output: +- self._capture_streams(self.capture_output) ++ self._capture_streams(True) + try: +- for suiteName, suitePlan in self.execution_plan.iteritems(): ++ for suiteName, suitePlan in self.execution_plan.items(): + batches = [batch for batch in self.suites[suiteName] if batch.__name__ in suitePlan['contexts']] + for batch in batches: + self.pool.spawn( +@@ -88,7 +91,8 @@ def run(self): + + self.pool.join() + finally: +- self._capture_streams(False) ++ if self.capture_output: ++ self._capture_streams(False) + + result.elapsed_time = elapsed(start_time) + return result +@@ -125,11 +129,11 @@ def _run_setup_and_topic(ctx_obj, index): + except Exception: + raise VowsTopicError('setup', sys.exc_info()) + +- # Find & run topic function +- if not hasattr(ctx_obj, 'topic'): # ctx_obj has no topic +- return ctx_obj._get_first_available_topic(index) +- + try: ++ # Find & run topic function ++ if not hasattr(ctx_obj, 'topic'): # ctx_obj has no topic ++ return ctx_obj._get_first_available_topic(index) ++ + topic_func = ctx_obj.topic + topic_list = get_topics_for(topic_func, ctx_obj) + +@@ -239,11 +243,11 @@ def _update_execution_plan(): + try: + topic = _run_setup_and_topic(ctx_obj, index) + _update_execution_plan() +- except SkipTest, se: ++ except SkipTest as se: + ctx_result['skip'] = se + skipReason = se + topic = None +- except VowsTopicError, e: ++ except VowsTopicError as e: + ctx_result['error'] = e + skipReason = SkipTest('topic dependency failed') + topic = None +@@ -251,7 +255,7 @@ def _update_execution_plan(): + if not ctx_result['error']: + try: + _run_teardown() +- except Exception, e: ++ except Exception as e: + ctx_result['error'] = e + finally: + ctx_result['stdout'] = VowsParallelRunner.output.stdout.getvalue() +diff --git a/setup.py b/setup.py +index 1b4945e..dbf2f4e 100755 +--- a/setup.py ++++ b/setup.py +@@ -24,8 +24,8 @@ + + ] + _install_requires = [ +- 'gevent>=0.13.6', +- 'preggy>=0.11.1', ++ 'gevent>=1.2.2', ++ 'preggy>=1.3.0', + ] + if sys.version_info < (2, 7): + _install_requires.append('argparse >= 1.1') +diff --git a/tests/assertions/like_vows.py b/tests/assertions/like_vows.py +index 49b6d89..8fca8e9 100644 +--- a/tests/assertions/like_vows.py ++++ b/tests/assertions/like_vows.py +@@ -8,6 +8,7 @@ + # http://www.opensource.org/licenses/mit-license + # Copyright (c) 2011 Bernardo Heynemann heynemann@gmail.com + ++import sys + from pyvows import Vows, expect + + +@@ -47,9 +48,6 @@ def we_assert_it_is_like_42(self, topic): + def we_assert_it_is_like_42_float(self, topic): + expect(topic).to_be_like(42.0) + +- def we_assert_it_is_like_42_long(self, topic): +- expect(topic).to_be_like(long(42)) +- + def we_assert_it_is_not_like_41(self, topic): + expect(topic).Not.to_be_like(41) + +diff --git a/tests/assertions/types/file_vows.py b/tests/assertions/types/file_vows.py +index 9249922..ae16022 100644 +--- a/tests/assertions/types/file_vows.py ++++ b/tests/assertions/types/file_vows.py +@@ -15,7 +15,9 @@ + STRINGS = { + 'that_are_files': ( + __file__, +- unicode(__file__), ++ (__file__.decode('utf8') ++ if isinstance(__file__, bytes) \ ++ else __file__), + ), + + 'that_are_not_files': ( +diff --git a/tests/bugs/64_vows.py b/tests/bugs/64_vows.py +index 248a089..451e3b4 100644 +--- a/tests/bugs/64_vows.py ++++ b/tests/bugs/64_vows.py +@@ -11,7 +11,10 @@ + from pyvows.result import VowsResult + from pyvows.reporting import VowsTestReporter # , VowsDefaultReporter + +-from StringIO import StringIO ++try: ++ from StringIO import StringIO ++except: ++ from io import StringIO + + + @Vows.batch +diff --git a/tests/context_inheritance_vows.py b/tests/context_inheritance_vows.py +index 741688d..dab1c32 100644 +--- a/tests/context_inheritance_vows.py ++++ b/tests/context_inheritance_vows.py +@@ -31,7 +31,8 @@ def topic(self, ponies): + # Second case: BaseSubcontext should be ignored. + class BaseSubcontext(Vows.Context): + +- def topic(self, (Thingy, ponies)): ++ def topic(self, v): ++ (Thingy, ponies) = v + self.ignore('prepare') + for pony in ponies: + yield (Thingy, self.prepare(pony)) +@@ -56,7 +57,8 @@ class ActualContext(BaseContext): + class ActualSubcontext(BaseContext.BaseSubcontext): + + def prepare(self, something): +- return unicode(something) ++ return something.decode('utf8') if isinstance(something, bytes) else something + +- def pony_is_alicorn(self, (Thingy, pony)): ++ def pony_is_alicorn(self, v): ++ (Thingy, pony) = v + expect(Thingy.alicorns).to_include(pony) +diff --git a/tests/prune_execution_vows.py b/tests/prune_execution_vows.py +index 9a708a4..e323f98 100644 +--- a/tests/prune_execution_vows.py ++++ b/tests/prune_execution_vows.py +@@ -141,7 +141,7 @@ def the_excluded_context_is_not_included(self, topic): + } + expect(topic).to_equal(baseline) + +- class WithBothInclusionAndExclution(Vows.Context): ++ class WithBothInclusionAndExclusion(Vows.Context): + @Vows.capture_error + def topic(self): + planner = ExecutionPlanner( +diff --git a/tests/reporting/error_reporting_vows.py b/tests/reporting/error_reporting_vows.py +index d290d2e..2846218 100644 +--- a/tests/reporting/error_reporting_vows.py ++++ b/tests/reporting/error_reporting_vows.py +@@ -12,7 +12,10 @@ + from pyvows.reporting import VowsDefaultReporter + from pyvows.runner.abc import VowsTopicError + +-from StringIO import StringIO ++try: ++ from StringIO import StringIO ++except: ++ from io import StringIO + + # These tests check that the reporting, which happens after all tests + # have run, correctly shows the errors raised in topic functions. +diff --git a/tests/reporting/xunit_reporter_vows.py b/tests/reporting/xunit_reporter_vows.py +index dec98f3..0433bc1 100644 +--- a/tests/reporting/xunit_reporter_vows.py ++++ b/tests/reporting/xunit_reporter_vows.py +@@ -34,11 +34,11 @@ def topic(self): + return reporter + + def should_create_xml_header(self, topic): +- expect(topic.to_xml().find('')).to_equal(0) ++ expect(topic.to_xml().find(b'')).to_equal(0) + + def should_have_a_testsuite_node(self, topic): +- expect(topic.to_xml()).to_match(r'.*') ++ expect(topic.to_xml()).to_match(br'.*') + + class WithDocument(Vows.Context): + def topic(self, topic): +diff --git a/tests/skipping_vows.py b/tests/skipping_vows.py +index 03e8dab..c5e1534 100644 +--- a/tests/skipping_vows.py ++++ b/tests/skipping_vows.py +@@ -6,7 +6,10 @@ + from pyvows.reporting.xunit import XUnitReporter + from pyvows.reporting.common import V_VERBOSE + +-from StringIO import StringIO ++try: ++ from StringIO import StringIO ++except: ++ from io import StringIO + + + @Vows.batch +@@ -331,7 +334,10 @@ def subcontext_shows_skipped_message(self, topic): + + def tests_should_not_run_vow_shows_run(self, topic): + expect(topic).Not.to_include('? tests should not run\n') +- expect(topic).to_include('tests should not run\n') ++ try: ++ expect(topic).to_include('tests should not run\n') ++ except: ++ expect(topic).to_include("b'tests should not run'\n") + + def subcontext_tests_should_also_not_run_vow_shows_skipped(self, topic): + expect(topic).to_include('? subcontext tests should also not run\n') + +diff --git a/pyvows/cli.py b/pyvows/cli.py +index 4850340..45ca215 100755 +--- a/pyvows/cli.py ++++ b/pyvows/cli.py +@@ -224,7 +224,7 @@ def main(): + + if xml: + if arguments.cover_report: +- with open(arguments.cover_report, 'w') as report: ++ with open(arguments.cover_report, 'wb') as report: + report.write(xml) + + arguments.cover_threshold /= 100.0 +diff --git a/pyvows/reporting/xunit.py b/pyvows/reporting/xunit.py +index f952dc3..969de3f 100644 +--- a/pyvows/reporting/xunit.py ++++ b/pyvows/reporting/xunit.py +@@ -26,7 +26,7 @@ class XUnitReporter(object): + def __init__(self, result): + self.result_summary = self.summarize_results(result) + +- def write_report(self, filename, encoding='utf-8'): ++ def write_report(self, filename, encoding=None): + # FIXME: Add Docstring + with codecs.open(filename, 'w', encoding, 'replace') as output_file: + output_file.write(self.to_xml(encoding)) diff --git a/py37-async-keyword.patch b/py37-async-keyword.patch new file mode 100644 index 0000000..0f2607c --- /dev/null +++ b/py37-async-keyword.patch @@ -0,0 +1,42 @@ +--- pyVows-2.1.0/pyvows/runner/utils.py.orig 2019-02-21 10:04:05.498271976 +0700 ++++ pyVows-2.1.0/pyvows/runner/utils.py 2019-02-21 10:04:56.462676610 +0700 +@@ -34,10 +34,10 @@ + # check for decorated topic function + if hasattr(topic_function, '_original'): + # _wrapper_type is 'async_topic' or 'capture_error' +- async = (getattr(topic_function, '_wrapper_type', None) == 'async_topic') ++ async_ = (getattr(topic_function, '_wrapper_type', None) == 'async_topic') + topic_function = topic_function._original + else: +- async = False ++ async_ = False + + code = get_code_for(topic_function) + +@@ -48,7 +48,7 @@ + expected_args = code.co_argcount - 1 + + # taking the callback argument into consideration +- if async: ++ if async_: + expected_args -= 1 + + # prepare to create `topics` list +--- pyVows-2.1.0/tests/async_vows.py.orig 2019-02-21 10:07:12.347754104 +0700 ++++ pyVows-2.1.0/tests/async_vows.py 2019-02-21 10:07:25.163855622 +0700 +@@ -15,13 +15,13 @@ + #------------------------------------------------------------------------------------------------- + + def asyncFunc(pool, callback): +- def async(): ++ def async_(): + time.sleep(0.1) + return 10 + + def get_value(value): + callback(value, 20, kwarg=30, kw2=40) +- pool.apply_async(async, callback=get_value) ++ pool.apply_async(async_, callback=get_value) + + #------------------------------------------------------------------------------------------------- + diff --git a/pyVows-2.1.0.tar.gz b/pyVows-2.1.0.tar.gz new file mode 100644 index 0000000..2e95a10 --- /dev/null +++ b/pyVows-2.1.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf5c866e3478defe52270efbaf399cb11b5602d63f0b4502eccce7dfb002b138 +size 36661 diff --git a/python-pyVows.changes b/python-pyVows.changes new file mode 100644 index 0000000..dcd6cde --- /dev/null +++ b/python-pyVows.changes @@ -0,0 +1,14 @@ +------------------------------------------------------------------- +Thu Feb 21 03:08:45 UTC 2019 - John Vandenberg + +- Update to v2.1.0 +- Activate test suite +- Use single spec format for Python 2 & 3 rpms +- Adds patch pr_133.patch for Python 3 support, and + py37-async-keyword.patch for Python 3.7 support. + +------------------------------------------------------------------- +Fri Jan 10 08:45:51 UTC 2014 - toms@opensuse.org + +- Initial version 2.0.4 + diff --git a/python-pyVows.spec b/python-pyVows.spec new file mode 100644 index 0000000..fa99dcf --- /dev/null +++ b/python-pyVows.spec @@ -0,0 +1,70 @@ +# +# spec file for package python-pyVows +# +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +Name: python-pyVows +Version: 2.1.0 +Release: 0 +Summary: BDD test engine based on Vows.js +License: MIT +Group: Development/Languages/Python +URL: https://github.com/heynemann/pyvows +Source: https://files.pythonhosted.org/packages/source/p/pyVows/pyVows-%{version}.tar.gz +# Extracted from https://patch-diff.githubusercontent.com/raw/heynemann/pyvows/pull/133.patch +Patch0: pr_133.patch +Patch1: py37-async-keyword.patch +BuildRequires: %{python_module Unidecode} +BuildRequires: %{python_module gevent >= 0.13.6} +BuildRequires: %{python_module colorama >= 0.3.7} +BuildRequires: %{python_module preggy >= 0.5.8} +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-Unidecode +Requires: python-gevent >= 1.2.2 +Requires: python-preggy >= 1.3.0 +Recommends: python-colorama >= 0.3.7 +BuildArch: noarch +%python_subpackages + +%description +pyVows is a BDD test engine based on Vows.js . + +%prep +%setup -q -n pyVows-%{version} +%patch0 -p1 +%patch1 -p1 +sed -i '/^#!/d' pyvows/__main__.py pyvows/cli.py + +%build +%python_build + +%install +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +export PYTHONPATH=. +export PATH=%{buildroot}%{_bindir}:$PATH +%python_exec pyvows/cli.py -x tests/ + +%files %{python_files} +%python3_only %{_bindir}/pyvows +%{python_sitelib}/* + +%changelog