This is an automated email from the ASF dual-hosted git repository.
kszucs pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new 1aecb98 ARROW-4179: [Python] Use more public API to determine whether
a test has a pytest mark or not
1aecb98 is described below
commit 1aecb987790bb78c084a2c8f4ce224acc2dfd13b
Author: Wes McKinney <[email protected]>
AuthorDate: Mon Jan 7 20:14:39 2019 +0100
ARROW-4179: [Python] Use more public API to determine whether a test has a
pytest mark or not
There was an internal API change in pytest 4.1.0 that resulted in our
pytest configuration logic failing to check if marks were set or not on unit
tests. I confirmed that the following fixes the problem both on pytest 4.0.x
(where things still worked) and 4.1.0 (when things broke)
Author: Wes McKinney <[email protected]>
Closes #3333 from wesm/ARROW-4179 and squashes the following commits:
646c1cb2 <Wes McKinney> Use iter_markers to get a list of marks for each
unit test since the behavior of item.obj changed
---
python/pyarrow/tests/conftest.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/python/pyarrow/tests/conftest.py b/python/pyarrow/tests/conftest.py
index 3c092cf..daaba59 100644
--- a/python/pyarrow/tests/conftest.py
+++ b/python/pyarrow/tests/conftest.py
@@ -146,6 +146,8 @@ def pytest_collection_modifyitems(config, items):
def pytest_runtest_setup(item):
only_set = False
+ item_marks = {mark.name: mark for mark in item.iter_markers()}
+
for group in groups:
flag = '--{0}'.format(group)
only_flag = '--only-{0}'.format(group)
@@ -154,7 +156,7 @@ def pytest_runtest_setup(item):
if item.config.getoption(only_flag):
only_set = True
- elif getattr(item.obj, group, None):
+ elif group in item_marks:
is_enabled = (item.config.getoption(flag) or
item.config.getoption(enable_flag))
is_disabled = item.config.getoption(disable_flag)
@@ -165,8 +167,7 @@ def pytest_runtest_setup(item):
skip_item = True
for group in groups:
only_flag = '--only-{0}'.format(group)
- if (getattr(item.obj, group, False) and
- item.config.getoption(only_flag)):
+ if group in item_marks and item.config.getoption(only_flag):
skip_item = False
if skip_item: