Skip to content

--pyargs discovery for zipped packages/unpacked wheels/eggs #1445

@bjodah

Description

@bjodah

EDIT:

Using py.test --pyargs mypackage does not seem to work for .egg distributed packages.
Adding

[easy_install]
zip_ok = False

to setup.cfg seems to be a viable fix until py.test supports zipped packages.

Original issue text:

Using py.test --pyargs mypackage under a conda environment seems to be broken.
I've reported it here: conda/conda#2075

I am reposting it here in case someone has an idea what might be going on here.
Here is a Dockerfile to reproduce the bug:

FROM continuumio/miniconda:3.19.0
MAINTAINER Björn Dahlgren <[email protected]>
ENV PATH /opt/miniconda2/bin:$PATH
RUN git clone https://github.com/bjodah/dummypkg.git && \
    cd dummypkg && \
    conda install conda-build pytest && \
    conda build conda-recipe && \
    conda install --use-local dummypkg
RUN cd /tmp && \
    python -c 'import dummypkg; print(dummypkg.__file__)' && \
    python -m pytest --pyargs dummypkg

Running docker build generates the following output:

$ docker build revised-docker-environment/
Sending build context to Docker daemon 2.048 kB
Sending build context to Docker daemon 
Step 0 : FROM continuumio/miniconda:3.19.0
 ---> bc9d0fb804ac
Step 1 : MAINTAINER Björn Dahlgren <[email protected]>
 ---> Using cache
 ---> f81cd6785b68
Step 2 : ENV PATH /opt/miniconda2/bin:$PATH
 ---> Using cache
 ---> 3227b31b6bd9
Step 3 : RUN git clone https://github.com/bjodah/dummypkg.git &&     cd dummypkg &&     conda install conda-build pytest &&     conda build conda-recipe &&     conda install --use-local dummypkg
 ---> Using cache
 ---> 6765cf1fae4d
Step 4 : RUN cd /tmp &&     python -c 'import dummypkg; print(dummypkg.__file__)' &&     python -m pytest --pyargs dummypkg
 ---> Running in e9c721e5c4c2
/opt/conda/lib/python2.7/site-packages/dummypkg-0.1.0-py2.7.egg/dummypkg/__init__.pyc
============================= test session starts ==============================
platform linux2 -- Python 2.7.10, pytest-2.8.5, py-1.4.31, pluggy-0.3.1
rootdir: /tmp, inifile: 

========================= no tests ran in 0.00 seconds =========================
ERROR: file or package not found: dummypkg
INFO[0000] The command [/bin/sh -c cd /tmp &&     python -c 'import dummypkg; print(dummypkg.__file__)' &&     python -m pytest --pyargs dummypkg] returned a non-zero code: 4 

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: collectionrelated to the collection phasetype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions