Skip to content

Add travis configuration to run the tests on 32 bit linux #9352

Closed

Description

@ogrisel

This issue should be "easy" if you are already familiar with:

  • travis configuration
  • bash scripting
  • docker

We need to add the following line in our .travis.yml:

sudo: required

services:
  - docker

more details in Using Docker in Builds.

Here is a minimalistic script that could put in build_tools/travis/docker_test.sh:

# This test script is mean to be executed with 'docker run' using one of the manylinux images
set -e
export PATH=/opt/python/cp36-cp36m/bin:$PATH
pip install numpy scipy cython nose pytest
cd /io
pip install -e .
pytest -l sklearn

This script can used to launch the test with (for 32 bit linux):

docker run --rm -v`pwd`:/io quay.io/pypa/manylinux1_i686 \
    bash /io/build_tools/travis/docker_test.sh

This command should be launched from the scikit-learn folder such that the -v flag mount the scikit-learn source folder of the host into the /io folder inside the container.

The above test script should be improved to specify the version number of python, numpy scipy and cython with environment variables defined in .travis.yml (that should be passed via the -e flag of the docker command).

Activity

  1. added
    Easy
    on Jul 13, 2017
  2. ogrisel commented on Jul 13, 2017

    @ogrisel
    MemberAuthor

    A side note: when running the tests on a 32 bit platform, the string representation of numpy arrays can change, leading to failing doctests such as follows:

    /io/sklearn/preprocessing/label.py:214: DocTestFailure
    _____________________________________________________________ [doctest] sklearn.preprocessing.label.label_binarize _____________________________________________________________
    417 
    418     Returns
    419     -------
    420     Y : numpy array or CSR matrix of shape [n_samples, n_classes]
    421         Shape will be [n_samples, 1] for binary problems.
    422 
    423     Examples
    424     --------
    425     >>> from sklearn.preprocessing import label_binarize
    426     >>> label_binarize([1, 6], classes=[1, 2, 4, 6])
    Expected:
        array([[1, 0, 0, 0],
               [0, 0, 0, 1]])
    Got:
        array([[1, 0, 0, 0],
               [0, 0, 0, 1]], dtype=int32)
    

    This means that we will need to find a way to configure pytest to not run the doctests in module docstrings. Currently we enable this by default in the pytest section of our setup.cfg.

    Maybe one could just delete the setup.cfg file before running the pytest command.

  3. jrmlhermitte commented on Jul 14, 2018

    @jrmlhermitte

    I can give this a try (at scipy2018 sprints)

  4. jrmlhermitte commented on Jun 19, 2019

    @jrmlhermitte

    Closed #13715 as I don't have time to contribute to this and this has grown stale. As a note, I had tried Travis, it worked, but then switched to Azure and I could not get it to work. good luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Build / CIEasyEnhancementSprinthelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions