8000 py.test test discovery in the root directory · Issue #9699 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

py.test test discovery in the root directory  #9699

@rth

Description

@rth

Not sure if this is addressed somewhere, but with the current migration to pytest, it would be nice if pytest was able to correctly collect unit tests from the scikit-learn root directory. Currently,

cd scikit-learn
py.test -sv .

fails (partial traceback below) because it believes that benchmarks are unit tests a and consequently fails to import some packages.

py.test -sv sklearn/

works correctly. There should be a way to modify the test discovery in pytest settings somewhere I imagine..

cc @lesteve @massich

(partial traceback below)

py.test -sv .               
==================================================================== test session starts ====================================================================
platform linux -- Python 3.6.1, pytest-3.0.7, py-1.4.33, pluggy-0.4.0 -- /home/rth/.miniconda3/envs/sklearn-env/bin/python
cachedir: .cache
rootdir: /home/rth/src/scikit-learn, inifile: setup.cfg
plugins: xdist-1.16.0
collecting 0 itemsPartial import of sklearn during the build process.
collecting 0 items / 17 errorsinput data sparsity: 0.050000
true coef sparsity: 0.000100
test data sparsity: 0.027400
model sparsity: 0.000024
r^2 on test data (dense model) : 0.232730
r^2 on test data (sparse model) : 0.232730
collecting 0 items / 17 errors================================================================================
#    Text vectorizers benchmark
================================================================================

Using a subset of the 20 newsrgoups dataset (11314 documents).
This benchmarks runs in ~20 min ...
^C^C
========================================================================== ERRORS ===========================================================================
______________________________________________________________ ERROR collecting test_speed.py _______________________________________________________________
test_speed.py:17: in <module>
    ipython.magic("%timeit row_norms(Xcsr)")
E   AttributeError: 'NoneType' object has no attribute 'magic'
______________________________________________________________ ERROR collecting test_speed.py _______________________________________________________________
test_speed.py:17: in <module>
    ipython.magic("%timeit row_norms(Xcsr)")
E   AttributeError: 'NoneType' object has no attribute 'magic'
___________________________________________________ ERROR collecting benchmarks/bench_isolation_forest.py ___________________________________________________
benchmarks/bench_isolation_forest.py:10: in <module>
    import matplotlib.pyplot as plt
E   ModuleNotFoundError: No module named 'matplotlib'

[and so on]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0