Skip to content

--pyargs cannot locate namespace packages installed in editable mode #1567

Closed
@taschini

Description

@taschini

The --pyargs command-line switch cannot locate libraries within a namespace package that are installed in editable mode.

How to reproduce

  1. In a fresh virtual environment install the attached pinned requirements:

    $ virtualenv env
    $ source env/bin/activate
    $ pip install -r pinned_requirements.txt
    

    This will install three libraries (more.basicauth, more.chameleon, more.forwarded) in editable mode, together with their dependencies.

    These libraries are all defined within the more namespace package.

  2. Run

    $ py.test --pyargs more.chamaleon

This is the output I get:

$ py.test --pyargs more.chamaleon
==================================================================== test session starts =====================================================================
platform darwin -- Python 2.7.11, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
rootdir:[…]/pytest_bug, inifile: 
plugins: cov-2.2.1

================================================================ no tests ran in 0.00 seconds ================================================================
ERROR: file or package not found: more.chamaleon

Expected output

I expect that py.test invocation to produce similar output as

$ py.test env/src/more.chameleon/more
==================================================================== test session starts =====================================================================
platform darwin -- Python 2.7.11, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
rootdir: […]/pytest_bug/env/src/more.chameleon, inifile: 
plugins: cov-2.2.1
collected 5 items 

env/src/more.chameleon/more/chameleon/tests/test_chameleon.py .....

================================================================== 5 passed in 0.51 seconds ==================================================================

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