Skip to content

py36 workaround for colorama in pytest 3.2 breaks pytest-xdist on Windows #2666

@nicoddemus

Description

@nicoddemus

Running tests with py36 and pytest 3.2 on Windows:

______________ TestLooponFailing.test_looponfail_multiple_errors ______________

self = <test_looponfail.TestLooponFailing object at 0x0000024907548A20>
testdir = <Testdir local('C:\\Users\\Bruno\\AppData\\Local\\Temp\\pytest-of-Bruno\\pytest-1432\\testdir\\test_looponfail_multiple_errors0')>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x0000024907548748>

    def test_looponfail_multiple_errors(self, testdir, monkeypatch):
        modcol = testdir.getmodulecol("""
                def test_one():
                    assert 0
            """)
        remotecontrol = RemoteControl(modcol.config)
        orig_runsession = remotecontrol.runsession

        def runsession_dups():
            # twisted.trial test cases may report multiple errors.
            failures, reports, collection_failed = orig_runsession()
            print(failures)
            return failures * 2, reports, collection_failed

        monkeypatch.setattr(remotecontrol, 'runsession', runsession_dups)
>       remotecontrol.loop_once()

X:\pytest-xdist\testing\test_looponfail.py:235:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x:\pytest-xdist\xdist\looponfail.py:113: in loop_once
    result = self.runsession()
X:\pytest-xdist\testing\test_looponfail.py:230: in runsession_dups
    failures, reports, collection_failed = orig_runsession()
x:\pytest-xdist\xdist\looponfail.py:102: in runsession
    return self.channel.receive()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Channel id=1 closed>, timeout = None

    def receive(self, timeout=None):
        """receive a data item that was sent from the other side.
            timeout: None [default] blocked waiting.  A positive number
            indicates the number of seconds after which a channel.TimeoutError
            exception will be raised if no item was received.
            Note that exceptions from the remotely executing code will be
            reraised as channel.RemoteError exceptions containing
            a textual representation of the remote traceback.
            """
        itemqueue = self._items
        if itemqueue is None:
            raise IOError("cannot receive(), channel has receiver callback")
        try:
            x = itemqueue.get(timeout=timeout)
        except self.gateway.execmodel.queue.Empty:
            raise self.TimeoutError("no item after %r seconds" % (timeout))
        if x is ENDMARKER:
            itemqueue.put(x)  # for other receivers
>           raise self._getremoteerror() or EOFError()
E           execnet.gateway_base.RemoteError: Traceback (most recent call last):
E             File "x:\pytest-xdist\.env36\lib\site-packages\execnet\gateway_base.py", line 1076, in executetask
E               function(channel, **kwargs)
E             File "<remote exec>", line 18, in init_slave_session
E             File "x:\pytest-xdist\.env36\lib\site-packages\_pytest\config.py", line 965, in fromdictargs
E               config.parse(args, addopts=False)
E             File "x:\pytest-xdist\.env36\lib\site-packages\_pytest\config.py", line 1106, in parse
E               self._preparse(args, addopts=addopts)
E             File "x:\pytest-xdist\.env36\lib\site-packages\_pytest\config.py", line 1077, in _preparse
E               args=args, parser=self._parser)
E             File "x:\pytest-xdist\.env36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 745, in __call__
E               return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
E             File "x:\pytest-xdist\.env36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 339, in _hookexec
E               return self._inner_hookexec(hook, methods, kwargs)
E             File "x:\pytest-xdist\.env36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 334, in <lambda>
E               _MultiCall(methods, kwargs, hook.spec_opts).execute()
E             File "x:\pytest-xdist\.env36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 613, in execute
E               return _wrapped_call(hook_impl.function(*args), self.execute)
E             File "x:\pytest-xdist\.env36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 245, in _wrapped_call
E               next(wrap_controller)   # first yield
E             File "x:\pytest-xdist\.env36\lib\site-packages\_pytest\capture.py", line 39, in pytest_load_initial_conftests
E               _py36_windowsconsoleio_workaround()
E             File "x:\pytest-xdist\.env36\lib\site-packages\_pytest\capture.py", line 521, in _py36_windowsconsoleio_workaround
E               buffered = hasattr(sys.stdout.buffer, 'raw')
E           AttributeError: 'ChannelFileWrite' object has no attribute 'buffer'

Metadata

Metadata

Assignees

Labels

plugin: capturerelated to the capture builtin plugintype: bugproblem that needs to be addressed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions