Issue #536 resolved
Loic Dachary created an issue

When running

tox -e py27

it sometime fails with the error attached below because some tests running in // by pytest-xdist interfere with each other. A workaround is to run with the -n 0 option.

tox -e py27 -- -n 0
$ tox -e py27
py27 develop-inst-noop: /home/loic/software/coveragepy/issue-433/coverage.py
py27 installed: apipkg==1.4,-e hg+ssh://hg@bitbucket.org/dachary/coverage.py@f787b514c0edfe67394f1bbfe2c9180c98f13f13#egg=coverage,covtestegg1==0.0.0,decorator==4.0.10,eventlet==0.19.0,execnet==1.4.1,funcsigs==1.0.2,gevent==1.1.2,greenlet==0.4.10,mock==2.0.0,pbr==1.10.0,py==1.4.32,PyContracts==1.7.12,pyparsing==2.1.10,pytest==3.0.5,pytest-warnings==0.2.0,pytest-xdist==1.15.0,six==1.10.0,unittest-mixins==1.1.1
py27 runtests: PYTHONHASHSEED='4089705858'
py27 runtests: commands[0] | python setup.py --quiet clean develop
warning: no previously-included files found matching 'ci/appveyor.token'
no previously-included directories found matching 'tests/eggsrc/dist'
no previously-included directories found matching 'tests/eggsrc/*.egg-info'
py27 runtests: commands[1] | python igor.py zip_mods install_egg remove_extension
py27 runtests: commands[2] | python igor.py test_with_tracer py
=== CPython 2.7.12 with Python tracer (.tox/py27/bin/python) ===
gw0 [685] / gw1 [685] / gw2 [685]
scheduling tests via LoadScheduling
............s.s...............................................................................s..s.s........s.............................s......................................................................................................s..................................................................................................................F......s...........................................................................................ssssssss.sssssssssss........................................................................s..................................................s......................................................................................
=================================================================== FAILURES ====================================================================
_____________________________________________________ test_farm[tests/farm/annotate/run.py] _____________________________________________________
[gw2] linux2 -- Python 2.7.12 /home/loic/software/coveragepy/issue-433/coverage.py/.tox/py27/bin/python
filename = 'tests/farm/annotate/run.py'

    @pytest.mark.parametrize("filename", TEST_FILES)
    def test_farm(filename):
>       FarmTestCase(filename).run_fully()

tests/test_farm.py:31: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_farm.py:132: in run_fully
    self()
tests/test_farm.py:123: in __call__
    execfile(self.runpy, glo)
run.py:8: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

cmds = '\n    coverage run white.py\n    coverage annotate white.py\n    ', rundir = 'out', outfile = None

    def run(cmds, rundir="src", outfile=None):
        """Run a list of commands.

        `cmds` is a string, commands separated by newlines.
        `rundir` is the directory in which to run the commands.
        `outfile` is a file name to redirect stdout to.

        """
        with change_dir(rundir):
            if outfile:
                fout = open(outfile, "a+")
            try:
                for cmd in cmds.split("\n"):
                    cmd = cmd.strip()
                    if not cmd:
                        continue
                    retcode, output = run_command(cmd)
                    print(output.rstrip())
                    if outfile:
                        fout.write(output)
                    if retcode:
>                       raise Exception("command exited abnormally")
E                       Exception: command exited abnormally

tests/test_farm.py:172: Exception
------------------------------------------------------------- Captured stdout call --------------------------------------------------------------
Traceback (most recent call last):
  File "/home/loic/software/coveragepy/issue-433/coverage.py/.tox/py27/bin/coverage", line 11, in <module>
    load_entry_point('coverage', 'console_scripts', 'coverage')()
  File "/home/loic/software/coveragepy/issue-433/coverage.py/.tox/py27/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 561, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/loic/software/coveragepy/issue-433/coverage.py/.tox/py27/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/home/loic/software/coveragepy/issue-433/coverage.py/.tox/py27/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/home/loic/software/coveragepy/issue-433/coverage.py/.tox/py27/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/loic/software/coveragepy/issue-433/coverage.py/coverage/__init__.py", line 13, in <module>
    from coverage.control import Coverage, process_startup
  File "/home/loic/software/coveragepy/issue-433/coverage.py/coverage/control.py", line 14, in <module>
    from coverage import env, files
  File "/home/loic/software/coveragepy/issue-433/coverage.py/coverage/files.py", line 166, in <module>
    set_relative_directory()
  File "/home/loic/software/coveragepy/issue-433/coverage.py/coverage/files.py", line 27, in set_relative_directory
    RELATIVE_DIR = os.path.normcase(abs_file(os.curdir) + os.sep)
  File "<decorator-gen-4>", line 2, in abs_file
  File "/home/loic/software/coveragepy/issue-433/coverage.py/.tox/py27/local/lib/python2.7/site-packages/contracts/main.py", line 255, in contracts_checker
    result = function_(*args, **kwargs)
  File "/home/loic/software/coveragepy/issue-433/coverage.py/coverage/files.py", line 155, in abs_file
    path = os.path.realpath(path)
  File "/home/loic/software/coveragepy/issue-433/coverage.py/.tox/py27/lib/python2.7/posixpath.py", line 376, in realpath
    return abspath(path)
  File "/home/loic/software/coveragepy/issue-433/coverage.py/.tox/py27/lib/python2.7/posixpath.py", line 364, in abspath
    cwd = os.getcwd()
OSError: [Errno 2] No such file or directory
1 failed, 654 passed, 30 skipped in 20.29 seconds
ERROR: InvocationError: '/home/loic/software/coveragepy/issue-433/coverage.py/.tox/py27/bin/python igor.py test_with_tracer py'
____________________________________________________________________ summary ____________________________________________________________________
ERROR:   py27: commands failed
(v) loic@fold:~/software/coveragepy/issue-433/coverage.py$

Comments (2)

  1. Log in to comment