pytest-dev / pytest-dev/pytest-xdist

Doesn't work with pytest-runner

Open
#41 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug enhancement help wanted
Dominant language
Python
Stars
1.9k
Forks
287
Avg merge
9h 30m
Merged PRs (30d)
2

Description

I have the following setup.py file:

from setuptools import setup, find_packages

setup(
    name="mypkg",
    package_dir={'': 'src'},
    packages=find_packages('src'),
    version="0.1",
    install_requires=["pytest-xdist", "toolz>=0.7.4", "boto", "pyrfc3339", "pytz", "mock"],
    setup_requires=["pytest-runner"],
    dependency_links=[],
    include_package_data=True,
    zip_safe=False)

And the following package layout:

.
├── pytest.ini
├── setup.py
├── src
│   └── mypkg
└── tests
    ├── __init__.py
    └── test_misc.py

Using pytest-runner, this works fine:

python setup.py pytest

But if I add the -f switch to run with pytest-xdist, it fails on dependecy resolution:

python setup.py pytest --addopts=-f                                                                                               -- INSERT --
running pytest
Searching for mock
Best match: mock 1.3.0
Processing mock-1.3.0-py2.7.egg

Using /Users/henriquealves/Code/nu/common-core-python/.eggs/mock-1.3.0-py2.7.egg
Searching for pytz
Best match: pytz 2015.7
Processing pytz-2015.7-py2.7.egg

Using /Users/henriquealves/Code/nu/common-core-python/.eggs/pytz-2015.7-py2.7.egg
Searching for pyrfc3339
Best match: pyRFC3339 1.0
Processing pyRFC3339-1.0-py2.7.egg

Using /Users/henriquealves/Code/nu/common-core-python/.eggs/pyRFC3339-1.0-py2.7.egg
Searching for boto
Best match: boto 2.39.0
Processing boto-2.39.0-py2.7.egg

Using /Users/henriquealves/Code/nu/common-core-python/.eggs/boto-2.39.0-py2.7.egg
Searching for toolz>=0.7.4
Best match: toolz 0.7.4
Processing toolz-0.7.4-py2.7.egg

Using /Users/henriquealves/Code/nu/common-core-python/.eggs/toolz-0.7.4-py2.7.egg
Searching for pytest-xdist
Best match: pytest-xdist 1.13.1
Processing pytest_xdist-1.13.1-py2.7.egg

Using /Users/henriquealves/Code/nu/common-core-python/.eggs/pytest_xdist-1.13.1-py2.7.egg
Searching for funcsigs
Best match: funcsigs 0.4
Processing funcsigs-0.4-py2.7.egg

Using /Users/henriquealves/Code/nu/common-core-python/.eggs/funcsigs-0.4-py2.7.egg
Searching for six>=1.7
Best match: six 1.10.0
Processing six-1.10.0-py2.7.egg

Using /Users/henriquealves/Code/nu/common-core-python/.eggs/six-1.10.0-py2.7.egg
Searching for pbr>=0.11
Best match: pbr 1.8.1
Processing pbr-1.8.1-py2.7.egg

Using /Users/henriquealves/Code/nu/common-core-python/.eggs/pbr-1.8.1-py2.7.egg
Searching for py>=1.4.22
Best match: py 1.4.31
Processing py-1.4.31-py2.7.egg

Using /Users/henriquealves/Code/nu/common-core-python/.eggs/py-1.4.31-py2.7.egg
Searching for pytest>=2.4.2
Best match: pytest 2.8.7
Processing pytest-2.8.7-py2.7.egg

Using /Users/henriquealves/Code/nu/common-core-python/.eggs/pytest-2.8.7-py2.7.egg
Searching for execnet>=1.1
Best match: execnet 1.4.1
Processing execnet-1.4.1-py2.7.egg

Using /Users/henriquealves/Code/nu/common-core-python/.eggs/execnet-1.4.1-py2.7.egg
Searching for apipkg>=1.4
Best match: apipkg 1.4
Processing apipkg-1.4-py2.7.egg

Using /Users/henriquealves/Code/nu/common-core-python/.eggs/apipkg-1.4-py2.7.egg
running egg_info
writing requirements to src/common_core_python.egg-info/requires.txt
writing src/common_core_python.egg-info/PKG-INFO
writing top-level names to src/common_core_python.egg-info/top_level.txt
writing dependency_links to src/common_core_python.egg-info/dependency_links.txt
reading manifest file 'src/common_core_python.egg-info/SOURCES.txt'
writing manifest file 'src/common_core_python.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 3, in <module>
  File "/Users/henriquealves/Code/nu/common-core-python/.eggs/execnet-1.4.1-py2.7.egg/execnet/__init__.py", line 9, in <module>
    import apipkg
ImportError: No module named apipkg
Traceback (most recent call last):
  File "setup.py", line 12, in <module>
    zip_safe=False)
  File "/Users/henriquealves/anaconda/envs/blank/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/Users/henriquealves/anaconda/envs/blank/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/Users/henriquealves/anaconda/envs/blank/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "build/bdist.macosx-10.5-x86_64/egg/ptr.py", line 79, in run
  File "/Users/henriquealves/anaconda/envs/blank/lib/python2.7/site-packages/setuptools-19.4-py2.7.egg/setuptools/command/test.py", line 140, in with_project_on_sys_path
  File "build/bdist.macosx-10.5-x86_64/egg/ptr.py", line 124, in run_tests
  File "/Users/henriquealves/Code/nu/common-core-python/.eggs/pytest-2.8.7-py2.7.egg/_pytest/config.py", line 48, in main
    return config.hook.pytest_cmdline_main(config=config)
  File "/Users/henriquealves/Code/nu/common-core-python/.eggs/pytest-2.8.7-py2.7.egg/_pytest/vendored_packages/pluggy.py", line 724, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/Users/henriquealves/Code/nu/common-core-python/.eggs/pytest-2.8.7-py2.7.egg/_pytest/vendored_packages/pluggy.py", line 338, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/Users/henriquealves/Code/nu/common-core-python/.eggs/pytest-2.8.7-py2.7.egg/_pytest/vendored_packages/pluggy.py", line 333, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File "/Users/henriquealves/Code/nu/common-core-python/.eggs/pytest-2.8.7-py2.7.egg/_pytest/vendored_packages/pluggy.py", line 596, in execute
    res = hook_impl.function(*args)
  File "/Users/henriquealves/Code/nu/common-core-python/.eggs/pytest_xdist-1.13.1-py2.7.egg/xdist/looponfail.py", line 24, in pytest_cmdline_main
    looponfail_main(config)
  File "/Users/henriquealves/Code/nu/common-core-python/.eggs/pytest_xdist-1.13.1-py2.7.egg/xdist/looponfail.py", line 35, in looponfail_main
    remotecontrol.loop_once()
  File "/Users/henriquealves/Code/nu/common-core-python/.eggs/pytest_xdist-1.13.1-py2.7.egg/xdist/looponfail.py", line 100, in loop_once
    self.setup()
  File "/Users/henriquealves/Code/nu/common-core-python/.eggs/pytest_xdist-1.13.1-py2.7.egg/xdist/looponfail.py", line 64, in setup
    self.gateway = self.initgateway()
  File "/Users/henriquealves/Code/nu/common-core-python/.eggs/pytest_xdist-1.13.1-py2.7.egg/xdist/looponfail.py", line 56, in initgateway
    return execnet.makegateway("popen")
  File "/Users/henriquealves/Code/nu/common-core-python/.eggs/execnet-1.4.1-py2.7.egg/execnet/multi.py", line 128, in makegateway
    gw = gateway_bootstrap.bootstrap(io, spec)
  File "/Users/henriquealves/Code/nu/common-core-python/.eggs/execnet-1.4.1-py2.7.egg/execnet/gateway_bootstrap.py", line 92, in bootstrap
    bootstrap_import(io, spec)
  File "/Users/henriquealves/Code/nu/common-core-python/.eggs/execnet-1.4.1-py2.7.egg/execnet/gateway_bootstrap.py", line 27, in bootstrap_import
    s = io.read(1)
  File "/Users/henriquealves/Code/nu/common-core-python/.eggs/execnet-1.4.1-py2.7.egg/execnet/gateway_base.py", line 389, in read
    "expected %d bytes, got %d" % (numbytes, len(buf)))
EOFError: expected 1 bytes, got 0

Here are the versions in .eggs:

README.txt          execnet-1.4.1-py2.7.egg     pbr-1.8.1-py2.7.egg     pytest-2.8.7-py2.7.egg      pytz-2015.7-py2.7.egg
apipkg-1.4-py2.7.egg        funcsigs-0.4-py2.7.egg      py-1.4.31-py2.7.egg     pytest_runner-2.6.2-py2.7.egg   six-1.10.0-py2.7.egg
boto-2.39.0-py2.7.egg       mock-1.3.0-py2.7.egg        pyRFC3339-1.0-py2.7.egg     pytest_xdist-1.13.1-py2.7.egg   toolz-0.7.4-py2.7.egg

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from setup.py with python setup.py pytest --addopts=-f, then inspect pytest-xdist's looponfail.py entry points and the traceback through execnet. Confirm the dependency-resolution behavior around apipkg and verify that the command completes without the ImportError or EOFError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.