scipy: python runtest.py -t path-to-test.py failed
My issue is about running specific test in my development environnement.
Reproducing code example:
I use the command described in the doc :
python runtests.py -v -t scipy/optimize/tests/test_linprog.py::test_unknown_solver --no-build
Error message:
=================================================================== test session starts ====================================================================
platform linux -- Python 3.8.5, pytest-6.2.2, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /workspaces/scipy, configfile: pytest.ini
collected 0 items
================================================================== no tests ran in 0.09s ===================================================================
ERROR: module or package not found: scipy/optimize/tests/test_linprog.py::test_unknown_solver (missing __init__.py?)
Scipy/Numpy/Python version information:
>>> import sys, scipy, numpy; print(scipy.__version__, numpy.__version__, sys.version_info)
1.7.0.dev0+a274d79 1.19.5 sys.version_info(major=3, minor=8, micro=5, releaselevel='final', serial=0)
OS:
Working with docker with the following Dockerfile:
# ubuntu focal has python 3.8 as default
FROM ubuntu:focal
# add deadsnakes ppa to install python 3.7
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository ppa:deadsnakes/ppa
RUN apt-get update && apt-get install -y \
python3.7 \
python3.7-dev \
python3-pip git \
build-essential \
vim \
libatlas-base-dev \
gfortran \
libgfortran4 \
liblapack-dev \
curl \
libgmp-dev \
libmpfr-dev \
libsuitesparse-dev \
libmpc-dev
# setup pips, pip3.7 and pip3.8
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3.7 get-pip.py && python3.8 get-pip.py && rm get-pip.py
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (16 by maintainers)
Commits related to this issue
- DOC: fix runtests guidelines. see #13440 — committed to V0lantis/scipy by V0lantis 3 years ago
Yes, it’s just a doc issue. A PR would be welcome. Please just change the test from
test_unknown_solver
totest_unknown_solvers_and_options
, as the test was renamed after this documentation about running tests was written. Thanks!Ah, I see what happened (to me, anyway–I’m not sure this helps @V0lantis). My attempt to use file paths failed because I used
-n
, and I am not using an in-place build (i.e. I first ranpython setup.py install
). To use-t
with a file path, I would need to give the path to the installed file, which is in the site-packages/scipy directory of the current Python installation.So one can use file paths or Python names. (I don’t see a reason to prefer either one, except perhaps for the case that I ran into.)
File paths work (at least one Windows and Mac), although it’s nice to know that Python names work, too. Are Python names preferred?
<strike>It looks like there is a mistake in those docs. The argument to the
-t
option should be a Python name (i.e. a dotted Python module path), not a file path</strike> Update: see comments below.And as @ilayn pointed out, the test that you were trying to run no longer exists.
This works for me:
::test_unknown_solver
is not an actual test because apparently it has been renamedhttps://github.com/scipy/scipy/blob/master/scipy/optimize/tests/test_linprog.py#L232
It is just an example anyways so feel free to pickup any other test.