diff --git a/.circleci/config.yml b/.circleci/config.yml index 3a1bc848942d3..e1e410c440314 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -65,6 +65,21 @@ jobs: path: ~/log.txt destination: log.txt + pypy3: + docker: + - image: pypy:3-6.0.0 + steps: + - restore_cache: + keys: + - pypy3-ccache-{{ .Branch }} + - pypy3-ccache + - checkout + - run: ./build_tools/circle/build_test_pypy.sh + - save_cache: + key: pypy3-ccache-{{ .Branch }}-{{ .BuildNum }} + paths: + - ~/.ccache + - ~/.cache/pip deploy: docker: @@ -89,6 +104,21 @@ workflows: jobs: - python3 - python2 + - pypy3: + filters: + branches: + only: + - 0.20.X - deploy: requires: - python3 + pypy: + triggers: + - schedule: + cron: "0 0 * * *" + filters: + branches: + only: + - master + jobs: + - pypy3 diff --git a/build_tools/circle/build_test_pypy.sh b/build_tools/circle/build_test_pypy.sh index 18fa361821d14..922bbac8e23a6 100755 --- a/build_tools/circle/build_test_pypy.sh +++ b/build_tools/circle/build_test_pypy.sh @@ -18,13 +18,16 @@ source pypy-env/bin/activate python --version which python -pip install --extra-index https://antocuni.github.io/pypy-wheels/ubuntu numpy==1.14.4 Cython pytest +pip install --extra-index https://antocuni.github.io/pypy-wheels/ubuntu numpy Cython pytest pip install "scipy>=1.1.0" sphinx numpydoc docutils ccache -M 512M export CCACHE_COMPRESS=1 export PATH=/usr/lib/ccache:$PATH +export LOKY_MAX_CPU_COUNT="2" -pip install -e . +pip install -vv -e . -make test +python -m pytest sklearn/ +python -m pytest doc/sphinxext/ +python -m pytest $(find doc -name '*.rst' | sort) diff --git a/conftest.py b/conftest.py index f175661165b2d..82c4b17faeef0 100644 --- a/conftest.py +++ b/conftest.py @@ -32,7 +32,9 @@ def pytest_collection_modifyitems(config, items): skip_marker = pytest.mark.skip( reason='FeatureHasher is not compatible with PyPy') for item in items: - if item.name == 'sklearn.feature_extraction.hashing.FeatureHasher': + if item.name in ( + 'sklearn.feature_extraction.hashing.FeatureHasher', + 'sklearn.feature_extraction.text.HashingVectorizer'): item.add_marker(skip_marker) # Skip tests which require internet if the flag is provided diff --git a/sklearn/feature_extraction/tests/test_text.py b/sklearn/feature_extraction/tests/test_text.py index b9431bc5439cb..d6b1b2b64b4c0 100644 --- a/sklearn/feature_extraction/tests/test_text.py +++ b/sklearn/feature_extraction/tests/test_text.py @@ -1108,6 +1108,8 @@ def test_vectorizers_invalid_ngram_range(vec): message = ("Invalid value for ngram_range=%s " "lower boundary larger than the upper boundary." % str(invalid_range)) + if isinstance(vec, HashingVectorizer): + pytest.xfail(reason='HashingVectorizer not supported on PyPy') assert_raise_message( ValueError, message, vec.fit, ["good news everyone"]) @@ -1119,6 +1121,7 @@ def test_vectorizers_invalid_ngram_range(vec): ValueError, message, vec.transform, ["good news everyone"]) +@fails_if_pypy def test_vectorizer_stop_words_inconsistent(): if PY2: lstr = "[u'and', u'll', u've']" diff --git a/sklearn/tests/test_docstring_parameters.py b/sklearn/tests/test_docstring_parameters.py index 648de6b6e6ca5..b4a831e571c4a 100644 --- a/sklearn/tests/test_docstring_parameters.py +++ b/sklearn/tests/test_docstring_parameters.py @@ -19,6 +19,8 @@ from sklearn.utils.testing import ignore_warnings from sklearn.utils.deprecation import _is_deprecated +import pytest + PUBLIC_MODULES = set([pckg[1] for pckg in walk_packages(prefix='sklearn.', path=sklearn.__path__) if not ("._" in pckg[1] or ".tests." in pckg[1])]) @@ -45,7 +47,8 @@ # numpydoc 0.8.0's docscrape tool raises because of collections.abc under # Python 3.7 -@ignore_warnings(category=DeprecationWarning) +@pytest.mark.filterwarnings('ignore::DeprecationWarning') +@pytest.mark.skipif(IS_PYPY, reason='test segfaults on PyPy') def test_docstring_parameters(): # Test module docstring formatting