Skip to content

QST: [contributor question] how to run tests against local repo with Docker development environment #45914

Closed
@rendner

Description

@rendner

This is a contribution related question.

To keep the configuration effort as small as possible, I want to use the Docker development environment.
The following commands are from the linked documentation:

# Build the image pandas-yourname-env
docker build --tag pandas-yourname-env .
# Run a container and bind your local forked repo, pandas-yourname, to the container
docker run -it --rm -v path-to-pandas-yourname:/home/pandas-yourname pandas-yourname-env

After a successful build of the Docker image. I want to run tests against my local forked repo.
The Docker image was build with: docker build --tag pandas-rendner-env .

Steps To Run Tests

  • start container: docker run -it --rm --workdir="/home/pandas" -v <PATH_TO_MY_LOCAL_FORKED_REPO>:/home/pandas pandas-rendner-env
  • run tests ./test_fast.sh

It fails with the following output:

ImportError while loading conftest '/home/pandas/pandas/conftest.py'.
pandas/__init__.py:22: in <module>
    from pandas.compat import is_numpy_dev as _is_numpy_dev
pandas/compat/__init__.py:15: in <module>
    from pandas.compat.numpy import (
pandas/compat/numpy/__init__.py:4: in <module>
    from pandas.util.version import Version
pandas/util/__init__.py:1: in <module>
    from pandas.util._decorators import (  # noqa:F401
pandas/util/_decorators.py:14: in <module>
    from pandas._libs.properties import cache_readonly  # noqa:F401
pandas/_libs/__init__.py:13: in <module>
    from pandas._libs.interval import Interval
E   ModuleNotFoundError: No module named 'pandas._libs.interval'

This is understandable because my local repo doesn't contain built C extensions.
But it was not expected by me after reading the example how to bind a local forked repo.

To make it work I have to build the C extensions with python setup.py build_ext -j 4 in the Docker container.
This additional step has to be done at least once (not on every container start) to create the required files.
Afterwards I can successfully run ./test_fast.sh.

Is this the correct way to run tests against a local repo? Or I'm doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions