Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[conftest] Advanced processing of logging #230

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

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test_conftest.py--devel is added
It is an internal code for testing a conftest.py.
  • Loading branch information
dmitry-lipetsk committed Apr 1, 2025
commit 282213f945a720a2f47660c0c3cbe173f370638b
80 changes: 80 additions & 0 deletions tests/test_conftest.py--devel
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import pytest
import logging


class TestConfest:
def test_failed(self):
raise Exception("TEST EXCEPTION!")

def test_ok(self):
pass

@pytest.mark.skip()
def test_mark_skip__no_reason(self):
pass

@pytest.mark.xfail()
def test_mark_xfail__no_reason(self):
raise Exception("XFAIL EXCEPTION")

@pytest.mark.xfail()
def test_mark_xfail__no_reason___no_error(self):
pass

@pytest.mark.skip(reason="reason")
def test_mark_skip__with_reason(self):
pass

@pytest.mark.xfail(reason="reason")
def test_mark_xfail__with_reason(self):
raise Exception("XFAIL EXCEPTION")

@pytest.mark.xfail(reason="reason")
def test_mark_xfail__with_reason___no_error(self):
pass

def test_exc_skip__no_reason(self):
pytest.skip()

def test_exc_xfail__no_reason(self):
pytest.xfail()

def test_exc_skip__with_reason(self):
pytest.skip(reason="SKIP REASON")

def test_exc_xfail__with_reason(self):
pytest.xfail(reason="XFAIL EXCEPTION")

def test_log_error(self):
logging.error("IT IS A LOG ERROR!")

def test_log_error_and_exc(self):
logging.error("IT IS A LOG ERROR!")

raise Exception("TEST EXCEPTION!")

def test_log_error_and_warning(self):
logging.error("IT IS A LOG ERROR!")
logging.warning("IT IS A LOG WARNING!")
logging.error("IT IS THE SECOND LOG ERROR!")
logging.warning("IT IS THE SECOND LOG WARNING!")

@pytest.mark.xfail()
def test_log_error_and_xfail_mark_without_reason(self):
logging.error("IT IS A LOG ERROR!")

@pytest.mark.xfail(reason="It is a reason message")
def test_log_error_and_xfail_mark_with_reason(self):
logging.error("IT IS A LOG ERROR!")

@pytest.mark.xfail()
def test_two_log_error_and_xfail_mark_without_reason(self):
logging.error("IT IS THE FIRST LOG ERROR!")
logging.info("----------")
logging.error("IT IS THE SECOND LOG ERROR!")

@pytest.mark.xfail(reason="It is a reason message")
def test_two_log_error_and_xfail_mark_with_reason(self):
logging.error("IT IS THE FIRST LOG ERROR!")
logging.info("----------")
logging.error("IT IS THE SECOND LOG ERROR!")