summaryrefslogtreecommitdiff
path: root/dev-python/pytest-xdist/files/pytest-xdist-1.34.0-pytest4.patch
blob: 8595480c01f0a15a417d12a4c45cd8898e1b2382 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From bd4e91d12bf6e20538d9b3acfe69536b3badcde5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Fri, 31 Jul 2020 20:13:24 +0200
Subject: [PATCH 1/3] Fix test_config_initialization condition for pytest<5

Fix test_config_initialization to be correctly skipped on pytest<5,
by explicitly checking pytest version (idea copied from
test_looponfail_removed_test).  The current conditions are insufficient
-- the outer check wrongly assumes pytest>=5 will always be used
on Python 3 (which is not true if you need the same version to support
both Python 2 and Python 3), and the inner condition apparently
wrongly assuming that invocation_params attribute is not present
in pytest-4.
---
 testing/acceptance_test.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py
index 7f9a551..29c5d9a 100644
--- a/testing/acceptance_test.py
+++ b/testing/acceptance_test.py
@@ -2,6 +2,7 @@ import os
 import re
 import sys
 import textwrap
+from pkg_resources import parse_version
 
 import py
 import pytest
@@ -594,15 +595,11 @@ def test_fixture_teardown_failure(testdir):
 
 
 @pytest.mark.skipif(
-    sys.version_info[:2] == (2, 7),
-    reason="Only available in pytest 5.0+ (Python 3 only)",
+    parse_version(pytest.__version__) < parse_version("5"),
+    reason="Only available in pytest 5.0+",
 )
 def test_config_initialization(testdir, monkeypatch, pytestconfig):
     """Ensure workers and master are initialized consistently. Integration test for #445"""
-    if not hasattr(pytestconfig, "invocation_params"):
-        pytest.skip(
-            "requires pytest >=5.1 (config has no attribute 'invocation_params')"
-        )
     testdir.makepyfile(
         **{
             "dir_a/test_foo.py": """
-- 
2.28.0