Skip to content

logging.error calls from non-robot code are treated as robot errors #300

Description

@anandautam1

Exception thrown from another import is not being suppressed when calling pytest.raises
I tested the scenario where a module right away throwing the import - and that works fine

OS: Running on windows

requirements:

python-can==3.3.4
pytest_robotframework==4.2.3

import can
import pytest
from robot.errors import HandlerExecutionFailed

def test_exception_from_other_module():
    with pytest.raises(OSError):
        bus = can.ThreadSafeBus(app_name='dummy', channel='vcan0', bustype='socketcan')

Without pytest_robotframework installed i dont get a failure

With pytest_robotframework installed i failed

I got:

================================== FAILURES ===================================
______________________ test_exception_from_other_module _______________________
robot errors occurred and were caught by pytest-robotframework:

- fcntl not available on this platform
---------------------------- Captured stderr call -----------------------------
[ ERROR ] fcntl not available on this platform
[ WARN ] libc is unavailable
------------------------------ Captured log call ------------------------------
ERROR    can.interfaces.socketcan.socketcan:socketcan.py:22 fcntl not available on this platform
WARNING  can.interfaces.socketcan.socketcan:socketcan.py:55 libc is unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions