From patchwork Sat May 2 11:31:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 21833 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9F7A227BBE4; Sat, 2 May 2020 12:33:13 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) by mira.cbaines.net (Postfix) with ESMTP id 5947927BBE1 for ; Sat, 2 May 2020 12:33:12 +0100 (BST) Received: from localhost ([::1]:38918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUqON-0007vZ-V4 for patchwork@mira.cbaines.net; Sat, 02 May 2020 07:33:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUqOH-0007sT-8D for guix-patches@gnu.org; Sat, 02 May 2020 07:33:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUqOE-00053m-P1 for guix-patches@gnu.org; Sat, 02 May 2020 07:33:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39894) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUqOE-00053f-D4 for guix-patches@gnu.org; Sat, 02 May 2020 07:33:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jUqOE-0008Dr-Ao for guix-patches@gnu.org; Sat, 02 May 2020 07:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41023] [PATCH core-updates] gnu: behave: Fix build with Python 3.8. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 02 May 2020 11:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41023 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41023@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.158841913930976 (code B ref -1); Sat, 02 May 2020 11:33:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 May 2020 11:32:19 +0000 Received: from localhost ([127.0.0.1]:51437 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUqNV-00081w-CQ for submit@debbugs.gnu.org; Sat, 02 May 2020 07:32:19 -0400 Received: from lists.gnu.org ([209.51.188.17]:43958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUqNG-0007rO-Du for submit@debbugs.gnu.org; Sat, 02 May 2020 07:32:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUqNF-0007gJ-1H for guix-patches@gnu.org; Sat, 02 May 2020 07:32:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUqNC-0004ZW-Dw for guix-patches@gnu.org; Sat, 02 May 2020 07:32:00 -0400 Received: from mira.cbaines.net ([212.71.252.8]:52298) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUqNB-0004ZP-SE for guix-patches@gnu.org; Sat, 02 May 2020 07:31:58 -0400 Received: from localhost (unknown [46.237.174.129]) by mira.cbaines.net (Postfix) with ESMTPSA id 70E0727BBE1 for ; Sat, 2 May 2020 12:31:56 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id b1876262 for ; Sat, 2 May 2020 11:31:54 +0000 (UTC) From: Christopher Baines Date: Sat, 2 May 2020 12:31:54 +0100 Message-Id: <20200502113154.4487-1-mail@cbaines.net> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 Received-SPF: pass client-ip=212.71.252.8; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/02 07:31:56 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Add a patch based on an upstream commit [1]. 1: c000c88eb5239b87f299c85e83b349b0ef387ae7 * gnu/packages/patches/behave-skip-a-couple-of-tests.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/check.scm (behave)[source]: Use the patch. --- gnu/local.mk | 1 + gnu/packages/check.scm | 4 +- .../behave-skip-a-couple-of-tests.patch | 476 ++++++++++++++++++ 3 files changed, 480 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/behave-skip-a-couple-of-tests.patch diff --git a/gnu/local.mk b/gnu/local.mk index 0111ae2161..7dac1c115f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -774,6 +774,7 @@ dist_patch_DATA = \ %D%/packages/patches/bc-fix-cross-compilation.patch \ %D%/packages/patches/beancount-disable-googleapis-fonts.patch \ %D%/packages/patches/beets-werkzeug-compat.patch \ + %D%/packages/patches/behave-skip-a-couple-of-tests.patch \ %D%/packages/patches/beignet-correct-file-names.patch \ %D%/packages/patches/benchmark-unbundle-googletest.patch \ %D%/packages/patches/biber-fix-encoding-write.patch \ diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm index 05a796a3e3..2629e88323 100644 --- a/gnu/packages/check.scm +++ b/gnu/packages/check.scm @@ -2107,7 +2107,9 @@ backported from Python 2.7 for Python 2.4+.") (uri (pypi-uri "behave" version)) (sha256 (base32 - "11hsz365qglvpp1m1w16239c3kiw15lw7adha49lqaakm8kj6rmr")))) + "11hsz365qglvpp1m1w16239c3kiw15lw7adha49lqaakm8kj6rmr")) + (patches (search-patches + "behave-skip-a-couple-of-tests.patch")))) (build-system python-build-system) (native-inputs `(("python-mock" ,python-mock) diff --git a/gnu/packages/patches/behave-skip-a-couple-of-tests.patch b/gnu/packages/patches/behave-skip-a-couple-of-tests.patch new file mode 100644 index 0000000000..4985f34425 --- /dev/null +++ b/gnu/packages/patches/behave-skip-a-couple-of-tests.patch @@ -0,0 +1,476 @@ +From c000c88eb5239b87f299c85e83b349b0ef387ae7 Mon Sep 17 00:00:00 2001 +From: jenisys +Date: Sun, 7 Jul 2019 12:43:19 +0200 +Subject: [PATCH] FIX: python3.8 regressions on CI server + +Issues w/ python3.8: +* Traceback: Line numbers of step functions differ (+1) +* JUnit XML: Attribute ordering of XML element differs (in output) +--- + behave.ini | 3 +- + features/environment.py | 14 ++++++ + features/step.duplicated_step.feature | 20 ++++---- + issue.features/environment.py | 38 ++++++++++++--- + issue.features/issue0330.feature | 64 ++++++++++++++++++++++++ + issue.features/issue0446.feature | 70 +++++++++++++++++++++++++++ + issue.features/issue0457.feature | 49 +++++++++++++++++++ + tox.ini | 2 +- + 8 files changed, 242 insertions(+), 18 deletions(-) + +diff --git a/behave.ini b/behave.ini +index 45c0f0d7..952240d6 100644 +--- a/behave.ini ++++ b/behave.ini +@@ -15,8 +15,9 @@ show_skipped = false + format = rerun + progress3 + outfiles = rerun.txt +- reports/report_progress3.txt ++ build/behave.reports/report_progress3.txt + junit = true ++junit_directory = build/behave.reports + logging_level = INFO + # logging_format = LOG.%(levelname)-8s %(name)-10s: %(message)s + # logging_format = LOG.%(levelname)-8s %(asctime)s %(name)-10s: %(message)s +diff --git a/features/environment.py b/features/environment.py +index 4744e89a..3769ee40 100644 +--- a/features/environment.py ++++ b/features/environment.py +@@ -1,5 +1,7 @@ + # -*- coding: UTF-8 -*- ++# FILE: features/environemnt.py + ++from __future__ import absolute_import, print_function + from behave.tag_matcher import ActiveTagMatcher, setup_active_tag_values + from behave4cmd0.setup_command_shell import setup_command_shell_processors4behave + import platform +@@ -20,6 +22,15 @@ + } + active_tag_matcher = ActiveTagMatcher(active_tag_value_provider) + ++ ++def print_active_tags_summary(): ++ active_tag_data = active_tag_value_provider ++ print("ACTIVE-TAG SUMMARY:") ++ print("use.with_python.version=%s" % active_tag_data.get("python.version")) ++ # print("use.with_os=%s" % active_tag_data.get("os")) ++ print() ++ ++ + # ----------------------------------------------------------------------------- + # HOOKS: + # ----------------------------------------------------------------------------- +@@ -30,11 +41,14 @@ def before_all(context): + setup_python_path() + setup_context_with_global_params_test(context) + setup_command_shell_processors4behave() ++ print_active_tags_summary() ++ + + def before_feature(context, feature): + if active_tag_matcher.should_exclude_with(feature.tags): + feature.skip(reason=active_tag_matcher.exclude_reason) + ++ + def before_scenario(context, scenario): + if active_tag_matcher.should_exclude_with(scenario.effective_tags): + scenario.skip(reason=active_tag_matcher.exclude_reason) +diff --git a/features/step.duplicated_step.feature b/features/step.duplicated_step.feature +index 59888b0f..396cca27 100644 +--- a/features/step.duplicated_step.feature ++++ b/features/step.duplicated_step.feature +@@ -32,11 +32,11 @@ Feature: Duplicated Step Definitions + AmbiguousStep: @given('I call Alice') has already been defined in + existing step @given('I call Alice') at features/steps/alice_steps.py:3 + """ +- And the command output should contain: +- """ +- File "features/steps/alice_steps.py", line 7, in +- @given(u'I call Alice') +- """ ++ # -- DISABLED: Python 3.8 traceback line numbers differ w/ decorators (+1). ++ # And the command output should contain: ++ # """ ++ # File "features/steps/alice_steps.py", line 7, in ++ # """ + + + Scenario: Duplicated Step Definition in another File +@@ -70,11 +70,11 @@ Feature: Duplicated Step Definitions + AmbiguousStep: @given('I call Bob') has already been defined in + existing step @given('I call Bob') at features/steps/bob1_steps.py:3 + """ +- And the command output should contain: +- """ +- File "features/steps/bob2_steps.py", line 3, in +- @given('I call Bob') +- """ ++ # -- DISABLED: Python 3.8 traceback line numbers differ w/ decorators (+1). ++ # And the command output should contain: ++ # """ ++ # File "features/steps/bob2_steps.py", line 3, in ++ # """ + + @xfail + Scenario: Duplicated Same Step Definition via import from another File +diff --git a/issue.features/environment.py b/issue.features/environment.py +index 2dfec751..7e48ee03 100644 +--- a/issue.features/environment.py ++++ b/issue.features/environment.py +@@ -1,5 +1,5 @@ + # -*- coding: UTF-8 -*- +-# FILE: features/environment.py ++# FILE: issue.features/environemnt.py + # pylint: disable=unused-argument + """ + Functionality: +@@ -7,17 +7,20 @@ + * active tags + """ + +-from __future__ import print_function ++ ++from __future__ import absolute_import, print_function + import sys + import platform + import os.path + import six + from behave.tag_matcher import ActiveTagMatcher + from behave4cmd0.setup_command_shell import setup_command_shell_processors4behave +-# PREPARED: +-# from behave.tag_matcher import setup_active_tag_values ++# PREPARED: from behave.tag_matcher import setup_active_tag_values + + ++# --------------------------------------------------------------------------- ++# TEST SUPPORT: For Active Tags ++# --------------------------------------------------------------------------- + def require_tool(tool_name): + """Check if a tool (an executable program) is provided on this platform. + +@@ -45,12 +48,14 @@ def require_tool(tool_name): + # print("TOOL-NOT-FOUND: %s" % tool_name) + return False + ++ + def as_bool_string(value): + if bool(value): + return "yes" + else: + return "no" + ++ + def discover_ci_server(): + # pylint: disable=invalid-name + ci_server = "none" +@@ -67,11 +72,17 @@ def discover_ci_server(): + return ci_server + + ++# --------------------------------------------------------------------------- ++# BEHAVE SUPPORT: Active Tags ++# --------------------------------------------------------------------------- + # -- MATCHES ANY TAGS: @use.with_{category}={value} + # NOTE: active_tag_value_provider provides category values for active tags. ++python_version = "%s.%s" % sys.version_info[:2] + active_tag_value_provider = { ++ "platform": sys.platform, + "python2": str(six.PY2).lower(), + "python3": str(six.PY3).lower(), ++ "python.version": python_version, + # -- python.implementation: cpython, pypy, jython, ironpython + "python.implementation": platform.python_implementation().lower(), + "pypy": str("__pypy__" in sys.modules).lower(), +@@ -82,17 +92,33 @@ def discover_ci_server(): + } + active_tag_matcher = ActiveTagMatcher(active_tag_value_provider) + ++ ++def print_active_tags_summary(): ++ active_tag_data = active_tag_value_provider ++ print("ACTIVE-TAG SUMMARY:") ++ print("use.with_python.version=%s" % active_tag_data.get("python.version")) ++ # print("use.with_platform=%s" % active_tag_data.get("platform")) ++ # print("use.with_os=%s" % active_tag_data.get("os")) ++ print() ++ ++ ++# --------------------------------------------------------------------------- ++# BEHAVE HOOKS: ++# --------------------------------------------------------------------------- + def before_all(context): + # -- SETUP ACTIVE-TAG MATCHER (with userdata): + # USE: behave -D browser=safari ... +- # NOT-NEEDED: setup_active_tag_values(active_tag_value_provider, +- # context.config.userdata) ++ # NOT-NEEDED: ++ # setup_active_tag_values(active_tag_value_provider, context.config.userdata) + setup_command_shell_processors4behave() ++ print_active_tags_summary() ++ + + def before_feature(context, feature): + if active_tag_matcher.should_exclude_with(feature.tags): + feature.skip(reason=active_tag_matcher.exclude_reason) + ++ + def before_scenario(context, scenario): + if active_tag_matcher.should_exclude_with(scenario.effective_tags): + scenario.skip(reason=active_tag_matcher.exclude_reason) +diff --git a/issue.features/issue0330.feature b/issue.features/issue0330.feature +index dc1ebe75..81cb6e29 100644 +--- a/issue.features/issue0330.feature ++++ b/issue.features/issue0330.feature +@@ -70,6 +70,7 @@ Feature: Issue #330: Skipped scenarios are included in junit reports when --no-s + And note that "bob.feature is skipped" + + ++ @not.with_python.version=3.8 + Scenario: Junit report for skipped feature is created with --show-skipped + When I run "behave --junit -t @tag1 --show-skipped @alice_and_bob.featureset" + Then it should pass with: +@@ -83,6 +84,23 @@ Feature: Issue #330: Skipped scenarios are included in junit reports when --no-s + + """ + ++ @use.with_python.version=3.8 ++ Scenario: Junit report for skipped feature is created with --show-skipped ++ When I run "behave --junit -t @tag1 --show-skipped @alice_and_bob.featureset" ++ Then it should pass with: ++ """ ++ 1 feature passed, 0 failed, 1 skipped ++ """ ++ And a file named "test_results/TESTS-alice.xml" exists ++ And a file named "test_results/TESTS-bob.xml" exists ++ And the file "test_results/TESTS-bob.xml" should contain: ++ """ ++ ++ """ ++ # -- HINT FOR: Python < 3.8 ++ # ++ ++ @not.with_python.version=3.8 + Scenario: Junit report for skipped scenario is neither shown nor counted with --no-skipped + When I run "behave --junit -t @tag1 --no-skipped" + Then it should pass with: +@@ -102,7 +120,30 @@ Feature: Issue #330: Skipped scenarios are included in junit reports when --no-s + """ + And note that "Charly2 is the skipped scenarion in charly.feature" + ++ @use.with_python.version=3.8 ++ Scenario: Junit report for skipped scenario is neither shown nor counted with --no-skipped ++ When I run "behave --junit -t @tag1 --no-skipped" ++ Then it should pass with: ++ """ ++ 2 features passed, 0 failed, 1 skipped ++ 2 scenarios passed, 0 failed, 2 skipped ++ """ ++ And a file named "test_results/TESTS-alice.xml" exists ++ And a file named "test_results/TESTS-charly.xml" exists ++ And the file "test_results/TESTS-charly.xml" should contain: ++ """ ++ " + + ++ @use.with_python.version=3.8 ++ Scenario: Hook error in before_scenario() ++ When I run "behave -f plain --junit features/before_scenario_failure.feature" ++ Then it should fail with: ++ """ ++ 0 scenarios passed, 1 failed, 0 skipped ++ """ ++ And the command output should contain: ++ """ ++ HOOK-ERROR in before_scenario: RuntimeError: OOPS ++ """ ++ And the file "reports/TESTS-before_scenario_failure.xml" should contain: ++ """ ++ ++ """ ++ # -- HINT FOR: Python < 3.8 ++ # ++ And the file "reports/TESTS-before_scenario_failure.xml" should contain: ++ """ ++ File "features/environment.py", line 6, in before_scenario ++ cause_hook_failure() ++ File "features/environment.py", line 2, in cause_hook_failure ++ raise RuntimeError("OOPS") ++ """ ++ And note that "the traceback is contained in the XML element " ++ ++ ++ @not.with_python.version=3.8 + Scenario: Hook error in after_scenario() + When I run "behave -f plain --junit features/after_scenario_failure.feature" + Then it should fail with: +@@ -114,3 +149,38 @@ Feature: Issue #446 -- Support scenario hook-errors with JUnitReporter + raise RuntimeError("OOPS") + """ + And note that "the traceback is contained in the XML element " ++ ++ ++ @use.with_python.version=3.8 ++ Scenario: Hook error in after_scenario() ++ When I run "behave -f plain --junit features/after_scenario_failure.feature" ++ Then it should fail with: ++ """ ++ 0 scenarios passed, 1 failed, 0 skipped ++ """ ++ And the command output should contain: ++ """ ++ Scenario: B1 ++ Given another step passes ... passed ++ HOOK-ERROR in after_scenario: RuntimeError: OOPS ++ """ ++ And the file "reports/TESTS-after_scenario_failure.xml" should contain: ++ """ ++ ++ """ ++ # -- HINT FOR: Python < 3.8 ++ # ++ And the file "reports/TESTS-after_scenario_failure.xml" should contain: ++ """ ++ File "features/environment.py", line 10, in after_scenario ++ cause_hook_failure() ++ File "features/environment.py", line 2, in cause_hook_failure ++ raise RuntimeError("OOPS") ++ """ ++ And note that "the traceback is contained in the XML element " +diff --git a/issue.features/issue0457.feature b/issue.features/issue0457.feature +index f80640e9..46f96e9c 100644 +--- a/issue.features/issue0457.feature ++++ b/issue.features/issue0457.feature +@@ -24,6 +24,7 @@ Feature: Issue #457 -- Double-quotes in error messages of JUnit XML reports + """ + + ++ @not.with_python.version=3.8 + Scenario: Use failing assertation in a JUnit XML report + Given a file named "features/fails1.feature" with: + """ +@@ -44,6 +45,31 @@ Feature: Issue #457 -- Double-quotes in error messages of JUnit XML reports + ++ """ ++ # -- HINT FOR: Python < 3.8 ++ # I am ++ ''' ++ """ ++ When I run "behave --junit features/fails2.feature" ++ Then it should fail with: ++ """ ++ 0 scenarios passed, 1 failed, 0 skipped ++ """ ++ And the file "reports/TESTS-fails2.xml" should contain: ++ """ ++ ++ """ ++ # -- HINT FOR: Python < 3.8 ++ #