Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture robot warnings and insert them into pytest #271

Open
KotlinIsland opened this issue May 24, 2024 · 0 comments
Open

Capture robot warnings and insert them into pytest #271

KotlinIsland opened this issue May 24, 2024 · 0 comments

Comments

@KotlinIsland
Copy link
Collaborator

Must consider robot warnings and user warnings (logger.warn/Log level=WARN)

# testing/test_asdf.py
from __future__ import annotations

import warnings


def test_it1():
    warnings.warn("I'm warning")
# testing/test.robot
*** Settings ***
Library     testing.util


*** Test Cases ***
Bar
    Log    I'm robot warning    level=warn
> pytest -p robotframework testing
================================================================================== test session starts ===================================================================================
platform win32 -- Python 3.12.2, pytest-8.2.1, pluggy-1.5.0 -- C:\Users\amongus\projects\pytest-robotframework\.venv\Scripts\python.exe
cachedir: .pytest_cache
rootdir: C:\Users\amongus\projects\pytest-robotframework
configfile: pyproject.toml
plugins: pytest_robotframework-4.1.4, github-actions-annotate-failures-0.2.0, xdist-3.6.1
collected 2 items
[ WARN ] Imported library 'testing.util' contains no keywords.

testing/test.robot::Bar PASSED                                                                                                                                                      [ 50%] 
testing/test_asdf.py::test_it1 PASSED                                                                                                                                               [100%] 

==================================================================================== warnings summary ==================================================================================== 
testing/test_asdf.py::test_it1
  c:\Users\amongus\projects\pytest-robotframework\testing\test_asdf.py:7: UserWarning: I'm warning
    warnings.warn("I'm warning")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

Robot Framework Output Files:
Log:     C:\Users\amongus\projects\pytest-robotframework\log.html
Log URI: file:///C:/Users/amongus/projects/pytest-robotframework/log.html
============================================================================== 2 passed, 1 warning in 0.24s ============================================================================== 
[ WARN ] I'm robot warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant