Warn if default numpy.int is 32bits, while running tests#14167
Merged
rth merged 5 commits intoscikit-learn:masterfrom Jul 2, 2019
Merged
Warn if default numpy.int is 32bits, while running tests#14167rth merged 5 commits intoscikit-learn:masterfrom
rth merged 5 commits intoscikit-learn:masterfrom
Conversation
The doctests would fail if the default numpy.int is 32 bits long. This warns the user if their numpy int is a 32 bit
Member
|
I'm not sure why you've replace all the content of the file. The issue also asks for a better documentation, which you'd need to include in the PR. Also, the linter is failing :) (you can check PEP8 for python style guides) |
Member
|
Is this supposed to replace #14163? |
Member
Member
|
I think that @rth as more this in head: diff --git a/conftest.py b/conftest.py
index f8ced99fc..73326d6d2 100644
--- a/conftest.py
+++ b/conftest.py
@@ -8,10 +8,12 @@
import platform
from distutils.version import LooseVersion
-from sklearn import set_config
import pytest
from _pytest.doctest import DoctestItem
+from sklearn import set_config
+from sklearn.utils import _IS_32BIT
+
PYTEST_MIN_VERSION = '3.3.0'
if LooseVersion(pytest.__version__) < PYTEST_MIN_VERSION:
@@ -51,13 +53,17 @@ def pytest_collection_modifyitems(config, items):
try:
import numpy as np
if LooseVersion(np.__version__) < LooseVersion('1.14'):
+ reason = 'doctests are only run for numpy >= 1.14'
+ skip_doctests = True
+ elif _IS_32BIT:
+ reason = ('doctest are only run when the default numpy int is '
+ '64 bits.')
skip_doctests = True
except ImportError:
pass
if skip_doctests:
- skip_marker = pytest.mark.skip(
- reason='doctests are only run for numpy >= 1.14 and python >= 3')
+ skip_marker = pytest.mark.skip(reason=reason)
for item in items:
if isinstance(item, DoctestItem):
|
Contributor
Author
|
Thanks @adrinjalali ,I'll work on that |
jnothman
reviewed
Jul 2, 2019
rth
reviewed
Jul 2, 2019
glemaitre
approved these changes
Jul 2, 2019
Closed
koenvandevelde
pushed a commit
to koenvandevelde/scikit-learn
that referenced
this pull request
Jul 12, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14029
The doctests would fail if the default numpy.int is 32 bits long. This warns the user if their numpy int is a 32 bit
Contributions made by @adrinjalali and @felexkemboi
#wimlds