From b247f574a3e2fb9209ab17cf220c87639402c539 Mon Sep 17 00:00:00 2001 From: Brian Okken <1568356+okken@users.noreply.github.com> Date: Fri, 22 Dec 2023 19:10:14 -0800 Subject: [PATCH] Slight tweak to xfail summary, and added tests --- test_xfail.py | 21 +++++++++++++++++++++ venv/pyvenv.cfg | 6 ++++++ xfail/pyproject.toml | 3 +++ xfail/test_xfail.py | 30 ++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 test_xfail.py create mode 100644 venv/pyvenv.cfg create mode 100644 xfail/pyproject.toml create mode 100644 xfail/test_xfail.py diff --git a/test_xfail.py b/test_xfail.py new file mode 100644 index 000000000..53cd13bf7 --- /dev/null +++ b/test_xfail.py @@ -0,0 +1,21 @@ +import pytest + +def test_pass(): + ... + + +def test_fail(): + a,b = 1,2 + assert a == b + +@pytest.mark.xfail +def test_xfail(): + a,b = 1,2 + assert a == b + + +@pytest.mark.xfail +def test_xpass(): + a,b = 1,1 + assert a == b + diff --git a/venv/pyvenv.cfg b/venv/pyvenv.cfg new file mode 100644 index 000000000..df2e94491 --- /dev/null +++ b/venv/pyvenv.cfg @@ -0,0 +1,6 @@ +home = /Library/Frameworks/Python.framework/Versions/3.11/bin +include-system-site-packages = false +version = 3.11.5 +prompt = 'pytest' +executable = /Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11 +command = /Library/Frameworks/Python.framework/Versions/3.11/bin/python3 -m venv --prompt="." /Users/okken/projects/pytest/venv diff --git a/xfail/pyproject.toml b/xfail/pyproject.toml new file mode 100644 index 000000000..81a978dc6 --- /dev/null +++ b/xfail/pyproject.toml @@ -0,0 +1,3 @@ +[tool.pytest.ini_options] +addopts = "-ra --strict-markers" +#xfail_strict = true diff --git a/xfail/test_xfail.py b/xfail/test_xfail.py new file mode 100644 index 000000000..2bf9d5840 --- /dev/null +++ b/xfail/test_xfail.py @@ -0,0 +1,30 @@ +import pytest + +def test_pass(): + print('in test_pass') + + +def test_fail(): + print('in test_fail') + a,b = 1,2 + assert a == b + +@pytest.mark.xfail +def test_xfail(): + print('in test_xfail') + a,b = 1,2 + assert a == b + +@pytest.mark.xfail(reason="reason 1") +def test_xfail_reason(): + print('in test_xfail') + a,b = 1,2 + assert a == b + + +@pytest.mark.xfail(reason="reason 2") +def test_xpass(): + print('in test_xpass') + a,b = 1,1 + assert a == b +