From bcc2bafb7eb513622773ba850d16ad1bfbbe3cdc Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 3 Feb 2021 00:21:51 +0100 Subject: [PATCH 1/8] add tests that print output --- tests/test_example1.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_example1.py b/tests/test_example1.py index 1442e2f..a757da3 100644 --- a/tests/test_example1.py +++ b/tests/test_example1.py @@ -1,3 +1,4 @@ +import sys import warnings import pytest @@ -18,6 +19,11 @@ def test_pass(): assert True +def test_pass_with_output(): + print("output") + print("error message", file=sys.stderr) + + def test_fail(): warn() assert False @@ -34,6 +40,11 @@ def test_xfail(): assert False +@pytest.mark.xfail(reason="xfail without a reason") +def test_xfail_reason(): + assert False + + @pytest.mark.xfail def test_xpass(): warn() From 07bd41093f3b8a55e283265fa0af3792a07fd609 Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 3 Feb 2021 00:22:21 +0100 Subject: [PATCH 2/8] add a skipped test module and a test module where all tests are skipped --- tests/test_example3.py | 4 ++++ tests/test_example4.py | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 tests/test_example3.py create mode 100644 tests/test_example4.py diff --git a/tests/test_example3.py b/tests/test_example3.py new file mode 100644 index 0000000..1b0bc7f --- /dev/null +++ b/tests/test_example3.py @@ -0,0 +1,4 @@ +import pytest + + +important_module = pytest.importorskip("lkjasdfölkja8723lkas98723_") \ No newline at end of file diff --git a/tests/test_example4.py b/tests/test_example4.py new file mode 100644 index 0000000..cd6e7e4 --- /dev/null +++ b/tests/test_example4.py @@ -0,0 +1,7 @@ +import pytest + +pytestmark = [pytest.mark.skipif(True, reason="skip for demonstration purposes")] + + +def test_pass(): + pass From 8ce4f98b407eace7b81e444e1c7cd76958ac2c1f Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 3 Feb 2021 00:23:16 +0100 Subject: [PATCH 3/8] add the json data for testing purposes --- test.json | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 test.json diff --git a/test.json b/test.json new file mode 100644 index 0000000..3a0a1eb --- /dev/null +++ b/test.json @@ -0,0 +1,73 @@ +{"pytest_version": "6.2.2", "$report_type": "SessionStart"} +{"nodeid": "", "outcome": "passed", "longrepr": null, "result": null, "sections": [], "$report_type": "CollectReport"} +{"nodeid": "tests/test_example1.py", "outcome": "passed", "longrepr": null, "result": null, "sections": [], "$report_type": "CollectReport"} +{"nodeid": "tests/test_example2.py::TestGroup", "outcome": "passed", "longrepr": null, "result": null, "sections": [], "$report_type": "CollectReport"} +{"nodeid": "tests/test_example2.py::TestGroup", "outcome": "passed", "longrepr": null, "result": null, "sections": [], "$report_type": "CollectReport"} +{"nodeid": "tests/test_example2.py::GroupTest", "outcome": "passed", "longrepr": null, "result": null, "sections": [], "$report_type": "CollectReport"} +{"nodeid": "tests/test_example2.py", "outcome": "passed", "longrepr": null, "result": null, "sections": [], "$report_type": "CollectReport"} +{"nodeid": "tests/test_example3.py", "outcome": "skipped", "longrepr": ["/home/lugh/Documents/Programming/emacs/pytest/tests/test_example3.py", 4, "Skipped: could not import 'lkjasdf\u00f6lkja8723lkas98723_': No module named 'lkjasdf\u00f6lkja8723lkas98723_'"], "result": null, "sections": [], "$report_type": "CollectReport"} +{"nodeid": "tests/test_example4.py", "outcome": "passed", "longrepr": null, "result": null, "sections": [], "$report_type": "CollectReport"} +{"nodeid": "tests/test_example1.py::test_pass", "location": ["tests/test_example1.py", 16, "test_pass"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "test_pass": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.00026758800231618807, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_pass", "location": ["tests/test_example1.py", 16, "test_pass"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "test_pass": 1}, "outcome": "passed", "longrepr": null, "when": "call", "user_properties": [], "sections": [], "duration": 0.0003977960004704073, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_pass", "location": ["tests/test_example1.py", 16, "test_pass"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "test_pass": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.00033361899841111153, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_pass_with_output", "location": ["tests/test_example1.py", 21, "test_pass_with_output"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "test_pass_with_output": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.00024384300195379183, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_pass_with_output", "location": ["tests/test_example1.py", 21, "test_pass_with_output"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "test_pass_with_output": 1}, "outcome": "passed", "longrepr": null, "when": "call", "user_properties": [], "sections": [["Captured stdout call", "output\n"], ["Captured stderr call", "error message\n"]], "duration": 0.0003927200014004484, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_pass_with_output", "location": ["tests/test_example1.py", 21, "test_pass_with_output"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "test_pass_with_output": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [["Captured stdout call", "output\n"], ["Captured stderr call", "error message\n"]], "duration": 0.0003037749993382022, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_fail", "location": ["tests/test_example1.py", 26, "test_fail"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "test_fail": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.00026951699692290276, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_fail", "location": ["tests/test_example1.py", 26, "test_fail"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "test_fail": 1}, "outcome": "failed", "longrepr": {"reprcrash": {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", "lineno": 29, "message": "assert False"}, "reprtraceback": {"reprentries": [{"type": "ReprEntry", "data": {"lines": [" def test_fail():", " warn()", "> assert False", "E assert False"], "reprfuncargs": {"args": []}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example1.py", "lineno": 29, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, "sections": [], "chain": [[{"reprentries": [{"type": "ReprEntry", "data": {"lines": [" def test_fail():", " warn()", "> assert False", "E assert False"], "reprfuncargs": {"args": []}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example1.py", "lineno": 29, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", "lineno": 29, "message": "assert False"}, null]]}, "when": "call", "user_properties": [], "sections": [], "duration": 0.00043938899761997163, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_fail", "location": ["tests/test_example1.py", 26, "test_fail"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "test_fail": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.0004675329983001575, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_error", "location": ["tests/test_example1.py", 31, "test_error"], "keywords": {"test_error": 1, "tests/test_example1.py": 1, "pytest": 1}, "outcome": "failed", "longrepr": {"reprcrash": {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", "lineno": 14, "message": "assert False"}, "reprtraceback": {"reprentries": [{"type": "ReprEntry", "data": {"lines": [" @pytest.fixture", " def failing():", "> assert False", "E assert False"], "reprfuncargs": {"args": []}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example1.py", "lineno": 14, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, "sections": [], "chain": [[{"reprentries": [{"type": "ReprEntry", "data": {"lines": [" @pytest.fixture", " def failing():", "> assert False", "E assert False"], "reprfuncargs": {"args": []}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example1.py", "lineno": 14, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", "lineno": 14, "message": "assert False"}, null]]}, "when": "setup", "user_properties": [], "sections": [], "duration": 0.00037439900188473985, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_error", "location": ["tests/test_example1.py", 31, "test_error"], "keywords": {"test_error": 1, "tests/test_example1.py": 1, "pytest": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.0004358430014690384, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_xfail", "location": ["tests/test_example1.py", 35, "test_xfail"], "keywords": {"test_xfail": 1, "xfail": 1, "pytest": 1, "pytestmark": 1, "tests/test_example1.py": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.00027707400295184925, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_xfail", "location": ["tests/test_example1.py", 35, "test_xfail"], "keywords": {"test_xfail": 1, "xfail": 1, "pytest": 1, "pytestmark": 1, "tests/test_example1.py": 1}, "outcome": "skipped", "longrepr": {"reprcrash": {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", "lineno": 40, "message": "assert False"}, "reprtraceback": {"reprentries": [{"type": "ReprEntry", "data": {"lines": [" @pytest.mark.xfail", " def test_xfail():", " warn()", " ", "> assert False", "E assert False"], "reprfuncargs": {"args": []}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example1.py", "lineno": 40, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, "sections": [], "chain": [[{"reprentries": [{"type": "ReprEntry", "data": {"lines": [" @pytest.mark.xfail", " def test_xfail():", " warn()", " ", "> assert False", "E assert False"], "reprfuncargs": {"args": []}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example1.py", "lineno": 40, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", "lineno": 40, "message": "assert False"}, null]]}, "when": "call", "user_properties": [], "sections": [], "duration": 0.0004169019957771525, "wasxfail": "", "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_xfail", "location": ["tests/test_example1.py", 35, "test_xfail"], "keywords": {"test_xfail": 1, "xfail": 1, "pytest": 1, "pytestmark": 1, "tests/test_example1.py": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.0003892230015480891, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_xfail_reason", "location": ["tests/test_example1.py", 42, "test_xfail_reason"], "keywords": {"xfail": 1, "pytest": 1, "pytestmark": 1, "tests/test_example1.py": 1, "test_xfail_reason": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.0002377780037932098, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_xfail_reason", "location": ["tests/test_example1.py", 42, "test_xfail_reason"], "keywords": {"xfail": 1, "pytest": 1, "pytestmark": 1, "tests/test_example1.py": 1, "test_xfail_reason": 1}, "outcome": "skipped", "longrepr": {"reprcrash": {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", "lineno": 45, "message": "assert False"}, "reprtraceback": {"reprentries": [{"type": "ReprEntry", "data": {"lines": [" @pytest.mark.xfail(reason=\"xfail without a reason\")", " def test_xfail_reason():", "> assert False", "E assert False"], "reprfuncargs": {"args": []}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example1.py", "lineno": 45, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, "sections": [], "chain": [[{"reprentries": [{"type": "ReprEntry", "data": {"lines": [" @pytest.mark.xfail(reason=\"xfail without a reason\")", " def test_xfail_reason():", "> assert False", "E assert False"], "reprfuncargs": {"args": []}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example1.py", "lineno": 45, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", "lineno": 45, "message": "assert False"}, null]]}, "when": "call", "user_properties": [], "sections": [], "duration": 0.00037447399517986923, "wasxfail": "xfail without a reason", "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_xfail_reason", "location": ["tests/test_example1.py", 42, "test_xfail_reason"], "keywords": {"xfail": 1, "pytest": 1, "pytestmark": 1, "tests/test_example1.py": 1, "test_xfail_reason": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.0003786629968089983, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_xpass", "location": ["tests/test_example1.py", 47, "test_xpass"], "keywords": {"xfail": 1, "test_xpass": 1, "pytest": 1, "pytestmark": 1, "tests/test_example1.py": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.00023435999901266769, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_xpass", "location": ["tests/test_example1.py", 47, "test_xpass"], "keywords": {"xfail": 1, "test_xpass": 1, "pytest": 1, "pytestmark": 1, "tests/test_example1.py": 1}, "outcome": "passed", "longrepr": null, "when": "call", "user_properties": [], "sections": [], "duration": 0.0003204929962521419, "wasxfail": "", "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_xpass", "location": ["tests/test_example1.py", 47, "test_xpass"], "keywords": {"xfail": 1, "test_xpass": 1, "pytest": 1, "pytestmark": 1, "tests/test_example1.py": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.0003025210025953129, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_skip", "location": ["tests/test_example1.py", 53, "test_skip"], "keywords": {"skipif": 1, "tests/test_example1.py": 1, "pytest": 1, "pytestmark": 1, "test_skip": 1}, "outcome": "skipped", "longrepr": ["/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", 54, "Skipped: skipping the test without a reason for testing purposes"], "when": "setup", "user_properties": [], "sections": [], "duration": 0.00020535500516416505, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_skip", "location": ["tests/test_example1.py", 53, "test_skip"], "keywords": {"skipif": 1, "tests/test_example1.py": 1, "pytest": 1, "pytestmark": 1, "test_skip": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.00025266699958592653, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[0]", "location": ["tests/test_example1.py", 78, "test_variations[0]"], "keywords": {"0": 1, "tests/test_example1.py": 1, "pytest": 1, "test_variations[0]": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.00035399599437369034, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[0]", "location": ["tests/test_example1.py", 78, "test_variations[0]"], "keywords": {"0": 1, "tests/test_example1.py": 1, "pytest": 1, "test_variations[0]": 1}, "outcome": "passed", "longrepr": null, "when": "call", "user_properties": [], "sections": [], "duration": 0.00030381899705389515, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[0]", "location": ["tests/test_example1.py", 78, "test_variations[0]"], "keywords": {"0": 1, "tests/test_example1.py": 1, "pytest": 1, "test_variations[0]": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.00036429699684958905, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[1]", "location": ["tests/test_example1.py", 78, "test_variations[1]"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "1": 1, "test_variations[1]": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.0003599519986892119, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[1]", "location": ["tests/test_example1.py", 78, "test_variations[1]"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "1": 1, "test_variations[1]": 1}, "outcome": "failed", "longrepr": {"reprcrash": {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", "lineno": 80, "message": "assert False\n + where False = example(1)"}, "reprtraceback": {"reprentries": [{"type": "ReprEntry", "data": {"lines": [" def test_variations(variable):", "> assert example(variable)", "E assert False", "E + where False = example(1)"], "reprfuncargs": {"args": [["variable", "1"]]}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example1.py", "lineno": 80, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, "sections": [], "chain": [[{"reprentries": [{"type": "ReprEntry", "data": {"lines": [" def test_variations(variable):", "> assert example(variable)", "E assert False", "E + where False = example(1)"], "reprfuncargs": {"args": [["variable", "1"]]}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example1.py", "lineno": 80, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", "lineno": 80, "message": "assert False\n + where False = example(1)"}, null]]}, "when": "call", "user_properties": [], "sections": [], "duration": 0.0004271489960956387, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[1]", "location": ["tests/test_example1.py", 78, "test_variations[1]"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "1": 1, "test_variations[1]": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.00043593499867711216, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[2]", "location": ["tests/test_example1.py", 78, "test_variations[2]"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "2": 1, "test_variations[2]": 1}, "outcome": "failed", "longrepr": {"reprcrash": {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", "lineno": 75, "message": "AssertionError: assert 2 != 2\n + where 2 = >.param"}, "reprtraceback": {"reprentries": [{"type": "ReprEntry", "data": {"lines": [" @pytest.fixture(", " params=[", " pytest.param(0),", " pytest.param(1),", " pytest.param(2),", " pytest.param(3, marks=pytest.mark.xfail),", " pytest.param(4, marks=pytest.mark.xfail),", " pytest.param(5, marks=pytest.mark.skip),", " ]", " )", " @pytest.mark.xfail", " @pytest.mark.skip", " def variable(request):", "> assert request.param != 2", "E AssertionError: assert 2 != 2", "E + where 2 = >.param"], "reprfuncargs": {"args": [["request", ">"]]}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example1.py", "lineno": 75, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, "sections": [], "chain": [[{"reprentries": [{"type": "ReprEntry", "data": {"lines": [" @pytest.fixture(", " params=[", " pytest.param(0),", " pytest.param(1),", " pytest.param(2),", " pytest.param(3, marks=pytest.mark.xfail),", " pytest.param(4, marks=pytest.mark.xfail),", " pytest.param(5, marks=pytest.mark.skip),", " ]", " )", " @pytest.mark.xfail", " @pytest.mark.skip", " def variable(request):", "> assert request.param != 2", "E AssertionError: assert 2 != 2", "E + where 2 = >.param"], "reprfuncargs": {"args": [["request", ">"]]}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example1.py", "lineno": 75, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", "lineno": 75, "message": "AssertionError: assert 2 != 2\n + where 2 = >.param"}, null]]}, "when": "setup", "user_properties": [], "sections": [], "duration": 0.000488559999212157, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[2]", "location": ["tests/test_example1.py", 78, "test_variations[2]"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "2": 1, "test_variations[2]": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.00042178400326520205, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[3]", "location": ["tests/test_example1.py", 78, "test_variations[3]"], "keywords": {"test_variations[3]": 1, "xfail": 1, "3": 1, "pytest": 1, "tests/test_example1.py": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.00035261199809610844, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[3]", "location": ["tests/test_example1.py", 78, "test_variations[3]"], "keywords": {"test_variations[3]": 1, "xfail": 1, "3": 1, "pytest": 1, "tests/test_example1.py": 1}, "outcome": "skipped", "longrepr": {"reprcrash": {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", "lineno": 80, "message": "assert False\n + where False = example(3)"}, "reprtraceback": {"reprentries": [{"type": "ReprEntry", "data": {"lines": [" def test_variations(variable):", "> assert example(variable)", "E assert False", "E + where False = example(3)"], "reprfuncargs": {"args": [["variable", "3"]]}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example1.py", "lineno": 80, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, "sections": [], "chain": [[{"reprentries": [{"type": "ReprEntry", "data": {"lines": [" def test_variations(variable):", "> assert example(variable)", "E assert False", "E + where False = example(3)"], "reprfuncargs": {"args": [["variable", "3"]]}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example1.py", "lineno": 80, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", "lineno": 80, "message": "assert False\n + where False = example(3)"}, null]]}, "when": "call", "user_properties": [], "sections": [], "duration": 0.0004110809968551621, "wasxfail": "", "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[3]", "location": ["tests/test_example1.py", 78, "test_variations[3]"], "keywords": {"test_variations[3]": 1, "xfail": 1, "3": 1, "pytest": 1, "tests/test_example1.py": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.0004417510062921792, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[4]", "location": ["tests/test_example1.py", 78, "test_variations[4]"], "keywords": {"test_variations[4]": 1, "4": 1, "xfail": 1, "pytest": 1, "tests/test_example1.py": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.00034788699849741533, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[4]", "location": ["tests/test_example1.py", 78, "test_variations[4]"], "keywords": {"test_variations[4]": 1, "4": 1, "xfail": 1, "pytest": 1, "tests/test_example1.py": 1}, "outcome": "passed", "longrepr": null, "when": "call", "user_properties": [], "sections": [], "duration": 0.00028570100403157994, "wasxfail": "", "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[4]", "location": ["tests/test_example1.py", 78, "test_variations[4]"], "keywords": {"test_variations[4]": 1, "4": 1, "xfail": 1, "pytest": 1, "tests/test_example1.py": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.00034982000215677544, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[5]", "location": ["tests/test_example1.py", 78, "test_variations[5]"], "keywords": {"pytest": 1, "5": 1, "test_variations[5]": 1, "tests/test_example1.py": 1, "skip": 1}, "outcome": "skipped", "longrepr": ["/home/lugh/Documents/Programming/emacs/pytest/tests/test_example1.py", 79, "Skipped: unconditional skip"], "when": "setup", "user_properties": [], "sections": [], "duration": 0.0002231719990959391, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_variations[5]", "location": ["tests/test_example1.py", 78, "test_variations[5]"], "keywords": {"pytest": 1, "5": 1, "test_variations[5]": 1, "tests/test_example1.py": 1, "skip": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.0002498499961802736, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_nested", "location": ["tests/test_example1.py", 82, "test_nested"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "test_nested": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.0002262639973196201, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_nested", "location": ["tests/test_example1.py", 82, "test_nested"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "test_nested": 1}, "outcome": "passed", "longrepr": null, "when": "call", "user_properties": [], "sections": [], "duration": 0.0003070620005019009, "$report_type": "TestReport"} +{"nodeid": "tests/test_example1.py::test_nested", "location": ["tests/test_example1.py", 82, "test_nested"], "keywords": {"tests/test_example1.py": 1, "pytest": 1, "test_nested": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.0003040730007342063, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::test_case", "location": ["tests/test_example2.py", 4, "test_case"], "keywords": {"test_case": 1, "pytest": 1, "tests/test_example2.py": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.0002549999990151264, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::test_case", "location": ["tests/test_example2.py", 4, "test_case"], "keywords": {"test_case": 1, "pytest": 1, "tests/test_example2.py": 1}, "outcome": "failed", "longrepr": {"reprcrash": {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example2.py", "lineno": 6, "message": "ValueError: always fails"}, "reprtraceback": {"reprentries": [{"type": "ReprEntry", "data": {"lines": [" def test_case():", "> raise ValueError(\"always fails\")", "E ValueError: always fails"], "reprfuncargs": {"args": []}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example2.py", "lineno": 6, "message": "ValueError"}, "style": "long"}}], "extraline": null, "style": "long"}, "sections": [], "chain": [[{"reprentries": [{"type": "ReprEntry", "data": {"lines": [" def test_case():", "> raise ValueError(\"always fails\")", "E ValueError: always fails"], "reprfuncargs": {"args": []}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example2.py", "lineno": 6, "message": "ValueError"}, "style": "long"}}], "extraline": null, "style": "long"}, {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example2.py", "lineno": 6, "message": "ValueError: always fails"}, null]]}, "when": "call", "user_properties": [], "sections": [], "duration": 0.0003349580001668073, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::test_case", "location": ["tests/test_example2.py", 4, "test_case"], "keywords": {"test_case": 1, "pytest": 1, "tests/test_example2.py": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.0003770219991565682, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::TestGroup::test_pass", "location": ["tests/test_example2.py", 12, "TestGroup.test_pass"], "keywords": {"skipif": 1, "()": 1, "pytest": 1, "TestGroup": 1, "tests/test_example2.py": 1, "test_pass": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.00023950300237629563, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::TestGroup::test_pass", "location": ["tests/test_example2.py", 12, "TestGroup.test_pass"], "keywords": {"skipif": 1, "()": 1, "pytest": 1, "TestGroup": 1, "tests/test_example2.py": 1, "test_pass": 1}, "outcome": "passed", "longrepr": null, "when": "call", "user_properties": [], "sections": [], "duration": 0.0003564610015018843, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::TestGroup::test_pass", "location": ["tests/test_example2.py", 12, "TestGroup.test_pass"], "keywords": {"skipif": 1, "()": 1, "pytest": 1, "TestGroup": 1, "tests/test_example2.py": 1, "test_pass": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.00030535700352629647, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::TestGroup::test_skip", "location": ["tests/test_example2.py", 15, "TestGroup.test_skip"], "keywords": {"skipif": 1, "tests/test_example2.py": 1, "()": 1, "pytest": 1, "pytestmark": 1, "TestGroup": 1, "test_skip": 1, "skip": 1}, "outcome": "skipped", "longrepr": ["/home/lugh/Documents/Programming/emacs/pytest/tests/test_example2.py", 16, "Skipped: a long and elaborate, multi-line reason on why this test has to fail"], "when": "setup", "user_properties": [], "sections": [], "duration": 0.00020762799977092072, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::TestGroup::test_skip", "location": ["tests/test_example2.py", 15, "TestGroup.test_skip"], "keywords": {"skipif": 1, "tests/test_example2.py": 1, "()": 1, "pytest": 1, "pytestmark": 1, "TestGroup": 1, "test_skip": 1, "skip": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.0002627140056574717, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::TestGroup::test_xfail", "location": ["tests/test_example2.py", 21, "TestGroup.test_xfail"], "keywords": {"skipif": 1, "test_xfail": 1, "()": 1, "xfail": 1, "pytest": 1, "pytestmark": 1, "TestGroup": 1, "tests/test_example2.py": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.0002486610028427094, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::TestGroup::test_xfail", "location": ["tests/test_example2.py", 21, "TestGroup.test_xfail"], "keywords": {"skipif": 1, "test_xfail": 1, "()": 1, "xfail": 1, "pytest": 1, "pytestmark": 1, "TestGroup": 1, "tests/test_example2.py": 1}, "outcome": "skipped", "longrepr": {"reprcrash": {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example2.py", "lineno": 24, "message": "assert False"}, "reprtraceback": {"reprentries": [{"type": "ReprEntry", "data": {"lines": [" @pytest.mark.xfail", " def test_xfail(self):", "> assert False", "E assert False"], "reprfuncargs": {"args": [["self", ""]]}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example2.py", "lineno": 24, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, "sections": [], "chain": [[{"reprentries": [{"type": "ReprEntry", "data": {"lines": [" @pytest.mark.xfail", " def test_xfail(self):", "> assert False", "E assert False"], "reprfuncargs": {"args": [["self", ""]]}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example2.py", "lineno": 24, "message": "AssertionError"}, "style": "long"}}], "extraline": null, "style": "long"}, {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example2.py", "lineno": 24, "message": "assert False"}, null]]}, "when": "call", "user_properties": [], "sections": [], "duration": 0.0003810960042756051, "wasxfail": "", "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::TestGroup::test_xfail", "location": ["tests/test_example2.py", 21, "TestGroup.test_xfail"], "keywords": {"skipif": 1, "test_xfail": 1, "()": 1, "xfail": 1, "pytest": 1, "pytestmark": 1, "TestGroup": 1, "tests/test_example2.py": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.0003728500014403835, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::TestGroup::test_xpass", "location": ["tests/test_example2.py", 25, "TestGroup.test_xpass"], "keywords": {"skipif": 1, "()": 1, "xfail": 1, "test_xpass": 1, "pytest": 1, "pytestmark": 1, "TestGroup": 1, "tests/test_example2.py": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.0002467360027367249, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::TestGroup::test_xpass", "location": ["tests/test_example2.py", 25, "TestGroup.test_xpass"], "keywords": {"skipif": 1, "()": 1, "xfail": 1, "test_xpass": 1, "pytest": 1, "pytestmark": 1, "TestGroup": 1, "tests/test_example2.py": 1}, "outcome": "passed", "longrepr": null, "when": "call", "user_properties": [], "sections": [], "duration": 0.0002949530025944114, "wasxfail": "", "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::TestGroup::test_xpass", "location": ["tests/test_example2.py", 25, "TestGroup.test_xpass"], "keywords": {"skipif": 1, "()": 1, "xfail": 1, "test_xpass": 1, "pytest": 1, "pytestmark": 1, "TestGroup": 1, "tests/test_example2.py": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.0003431719960644841, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::GroupTest::test_fail", "location": ["tests/test_example2.py", 34, "GroupTest.test_fail"], "keywords": {"GroupTest": 1, "tests/test_example2.py": 1, "pytest": 1, "test_fail": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.0004810719983652234, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::GroupTest::test_fail", "location": ["tests/test_example2.py", 34, "GroupTest.test_fail"], "keywords": {"GroupTest": 1, "tests/test_example2.py": 1, "pytest": 1, "test_fail": 1}, "outcome": "failed", "longrepr": {"reprcrash": {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example2.py", "lineno": 36, "message": "ValueError: always fails"}, "reprtraceback": {"reprentries": [{"type": "ReprEntry", "data": {"lines": [" def test_fail(self):", "> raise ValueError(\"always fails\")", "E ValueError: always fails"], "reprfuncargs": {"args": [["self", ""]]}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example2.py", "lineno": 36, "message": "ValueError"}, "style": "long"}}], "extraline": null, "style": "long"}, "sections": [], "chain": [[{"reprentries": [{"type": "ReprEntry", "data": {"lines": [" def test_fail(self):", "> raise ValueError(\"always fails\")", "E ValueError: always fails"], "reprfuncargs": {"args": [["self", ""]]}, "reprlocals": null, "reprfileloc": {"path": "tests/test_example2.py", "lineno": 36, "message": "ValueError"}, "style": "long"}}], "extraline": null, "style": "long"}, {"path": "/home/lugh/Documents/Programming/emacs/pytest/tests/test_example2.py", "lineno": 36, "message": "ValueError: always fails"}, null]]}, "when": "call", "user_properties": [], "sections": [], "duration": 0.0004581339962896891, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::GroupTest::test_fail", "location": ["tests/test_example2.py", 34, "GroupTest.test_fail"], "keywords": {"GroupTest": 1, "tests/test_example2.py": 1, "pytest": 1, "test_fail": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.00036222999915480614, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::GroupTest::test_pass", "location": ["tests/test_example2.py", 31, "GroupTest.test_pass"], "keywords": {"GroupTest": 1, "pytest": 1, "tests/test_example2.py": 1, "test_pass": 1}, "outcome": "passed", "longrepr": null, "when": "setup", "user_properties": [], "sections": [], "duration": 0.00042721800127765164, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::GroupTest::test_pass", "location": ["tests/test_example2.py", 31, "GroupTest.test_pass"], "keywords": {"GroupTest": 1, "pytest": 1, "tests/test_example2.py": 1, "test_pass": 1}, "outcome": "passed", "longrepr": null, "when": "call", "user_properties": [], "sections": [], "duration": 0.0015028600028017536, "$report_type": "TestReport"} +{"nodeid": "tests/test_example2.py::GroupTest::test_pass", "location": ["tests/test_example2.py", 31, "GroupTest.test_pass"], "keywords": {"GroupTest": 1, "pytest": 1, "tests/test_example2.py": 1, "test_pass": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.0007173850026447326, "$report_type": "TestReport"} +{"nodeid": "tests/test_example4.py::test_pass", "location": ["tests/test_example4.py", 5, "test_pass"], "keywords": {"skipif": 1, "pytest": 1, "tests/test_example4.py": 1, "test_pass": 1}, "outcome": "skipped", "longrepr": ["/home/lugh/Documents/Programming/emacs/pytest/tests/test_example4.py", 6, "Skipped: skip for demonstration purposes"], "when": "setup", "user_properties": [], "sections": [], "duration": 0.00022610400628764182, "$report_type": "TestReport"} +{"nodeid": "tests/test_example4.py::test_pass", "location": ["tests/test_example4.py", 5, "test_pass"], "keywords": {"skipif": 1, "pytest": 1, "tests/test_example4.py": 1, "test_pass": 1}, "outcome": "passed", "longrepr": null, "when": "teardown", "user_properties": [], "sections": [], "duration": 0.0002561799992690794, "$report_type": "TestReport"} +{"exitstatus": 1, "$report_type": "SessionFinish"} From ceccf59c02a826168cb0a43f171e400674872fa6 Mon Sep 17 00:00:00 2001 From: Keewis Date: Sat, 6 Feb 2021 16:43:57 +0100 Subject: [PATCH 4/8] fix the info tests --- tests/test-info.el | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/test-info.el b/tests/test-info.el index 7b52ed0..46eb20e 100644 --- a/tests/test-info.el +++ b/tests/test-info.el @@ -75,46 +75,46 @@ (describe "a function to check if the current statement is a decorator (pytest-info--decorator-p)" (it "detects the first line of a decorator" - (expect (with-mark-at-line buffer1 11 (pytest-info--decorator-p)) :to-be t)) + (expect (with-mark-at-line buffer1 13 (pytest-info--decorator-p)) :to-be t)) (it "detects continuation lines of a decorator" - (expect (with-mark-at-line buffer1 44 (pytest-info--decorator-p)) :to-be t)) + (expect (with-mark-at-line buffer1 56 (pytest-info--decorator-p)) :to-be t)) (it "detects the indented first line of a decorator" - (expect (with-mark-at-line buffer2 22 (pytest-info--decorator-p)) :to-be t)) + (expect (with-mark-at-line buffer2 24 (pytest-info--decorator-p)) :to-be t)) (it "detects indented continuation lines of a decorator" - (expect (with-mark-at-line buffer2 17 (pytest-info--decorator-p)) :to-be t)) + (expect (with-mark-at-line buffer2 19 (pytest-info--decorator-p)) :to-be t)) (it "does not detect function declarations" - (expect (with-mark-at-line buffer1 12 (pytest-info--decorator-p)) :to-be nil)) + (expect (with-mark-at-line buffer1 14 (pytest-info--decorator-p)) :to-be nil)) (it "does not detect normal statements" - (expect (with-mark-at-line buffer1 23 (pytest-info--decorator-p)) :to-be nil))) + (expect (with-mark-at-line buffer1 30 (pytest-info--decorator-p)) :to-be nil))) (describe "a function to collect information about the current position (pytest-info-current-pos)" (it "does not collect information about a empty line at module level" - (expect (with-mark-at-line buffer1 5 (pytest-info-current-pos)) + (expect (with-mark-at-line buffer1 7 (pytest-info-current-pos)) :to-equal nil)) (it "detects a plain function" - (expect (with-mark-at-line buffer1 7 (pytest-info-current-pos)) + (expect (with-mark-at-line buffer1 9 (pytest-info-current-pos)) :to-equal (list filepath1 "warn")) - (expect (with-mark-at-line buffer1 8 (pytest-info-current-pos)) + (expect (with-mark-at-line buffer1 10 (pytest-info-current-pos)) :to-equal (list filepath1 "warn"))) (it "detects a function with a decorator" - (expect (with-mark-at-line buffer1 11 (pytest-info-current-pos)) + (expect (with-mark-at-line buffer1 13 (pytest-info-current-pos)) :to-equal (list filepath1 "failing")) - (expect (with-mark-at-line buffer1 43 (pytest-info-current-pos)) + (expect (with-mark-at-line buffer1 55 (pytest-info-current-pos)) :to-equal (list filepath1 "test_skip"))) (it "detects a function with multiple decorators" - (expect (with-mark-at-line buffer1 61 (pytest-info-current-pos)) + (expect (with-mark-at-line buffer1 73 (pytest-info-current-pos)) :to-equal (list filepath1 "variable")) - (expect (with-mark-at-line buffer1 58 (pytest-info-current-pos)) + (expect (with-mark-at-line buffer1 70 (pytest-info-current-pos)) :to-equal (list filepath1 "variable")) - (expect (with-mark-at-line buffer1 51 (pytest-info-current-pos)) + (expect (with-mark-at-line buffer1 63 (pytest-info-current-pos)) :to-equal (list filepath1 "variable"))) (it "detects a function from within the function's body" - (expect (with-mark-at-line buffer1 33 (pytest-info-current-pos)) + (expect (with-mark-at-line buffer1 40 (pytest-info-current-pos)) :to-equal (list filepath1 "test_xfail"))))) From 1ebf05cd9bc04d9422e6f6275a85282877ec1ca1 Mon Sep 17 00:00:00 2001 From: Keewis Date: Sat, 6 Feb 2021 16:52:02 +0100 Subject: [PATCH 5/8] run pre-commit --- tests/test_example3.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_example3.py b/tests/test_example3.py index 1b0bc7f..b644abe 100644 --- a/tests/test_example3.py +++ b/tests/test_example3.py @@ -1,4 +1,3 @@ import pytest - -important_module = pytest.importorskip("lkjasdfölkja8723lkas98723_") \ No newline at end of file +important_module = pytest.importorskip("lkjasdfölkja8723lkas98723_") From 8ac0e862fbd068a217df244529e1573dd0dcbf67 Mon Sep 17 00:00:00 2001 From: Keewis Date: Tue, 9 Feb 2021 01:51:34 +0100 Subject: [PATCH 6/8] rename test.json to test.log --- test.json => test.log | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test.json => test.log (100%) diff --git a/test.json b/test.log similarity index 100% rename from test.json rename to test.log From dcca31770c822de8f5868a7e15b13e3374e4694e Mon Sep 17 00:00:00 2001 From: Keewis Date: Sun, 10 Oct 2021 18:42:08 +0200 Subject: [PATCH 7/8] use make-process to read stderr to a separate buffer --- lisp/pytest-process.el | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lisp/pytest-process.el b/lisp/pytest-process.el index b98958a..5f76d3e 100644 --- a/lisp/pytest-process.el +++ b/lisp/pytest-process.el @@ -49,21 +49,27 @@ to work in every virtual environment." "Construct the base command for pytest." (cons (pytest--python) '("-m" "pytest"))) -(defun pytest--execute (name command dir output-buffer) +(defun pytest--execute (name command dir output-buffer &optional error-buffer) "Execute COMMAND asynchronously in DIR. NAME is a name for the process. -stdout is written to OUTPUT-BUFFER, which needs to be a buffer, not a string." +stdout is written to OUTPUT-BUFFER, which needs to be a buffer, not a string. +stderr is written to ERROR-BUFFER, which also needs to be a buffer." (let ((default-directory dir)) - (start-process-shell-command name output-buffer command))) + (make-process + :name name + :buffer output-buffer + :stderr error-buffer + :connection-type 'pipe + :command command))) (defun pytest--construct-command (args) "Construct the pytest command using ARGS." (let ((command (append (pytest--command) args))) (s-join " " command))) -(defun pytest--run (&optional args dir output-buffer) +(defun pytest--run (&optional args dir output-buffer error-buffer) "Run pytest with ARGS (if any) in the given DIR and write to OUTPUT-BUFFER. If optional ARGS is non-nil, these are passed to pytest. @@ -72,10 +78,11 @@ If optional DIR is non-nil, pytest is run in that directory. Otherwise it is run in the project's root as defined by projectile or the current working directory. -If optional OUTPUT-BUFFER is non-nil, write to that buffer." +If optional OUTPUT-BUFFER is non-nil, write stderr to that buffer. +If optional ERROR-BUFFER is non-nil, write stderr to that buffer." (let ((command (pytest--construct-command args)) (default-directory (or dir (projectile-project-root)))) - (pytest--execute "pytest" command default-directory output-buffer))) + (pytest--execute "pytest" command default-directory output-buffer error-buffer))) (provide 'pytest-process) ;;; pytest-process.el ends here From de17ed57be20eafe29c30ec1bd5ff0fac9cab811 Mon Sep 17 00:00:00 2001 From: Keewis Date: Sat, 16 Oct 2021 20:29:29 +0200 Subject: [PATCH 8/8] use the builtin file-name-absolute-p instead of f-absolute? which makes us able to avoid depending on 'f --- ci/requirements.el | 2 +- lisp/pytest-process.el | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ci/requirements.el b/ci/requirements.el index 44f3af7..4ef3ca7 100644 --- a/ci/requirements.el +++ b/ci/requirements.el @@ -29,7 +29,7 @@ (package-initialize) (package-refresh-contents) -(setq package-selected-packages '(f s projectile cl buttercup)) +(setq package-selected-packages '(s projectile cl buttercup)) (package-install-selected-packages) diff --git a/lisp/pytest-process.el b/lisp/pytest-process.el index 5f76d3e..3a0d293 100644 --- a/lisp/pytest-process.el +++ b/lisp/pytest-process.el @@ -22,7 +22,6 @@ ;;; Code: (require 'projectile) -(require 'f) (require 's) (require 'pytest-core) @@ -41,7 +40,7 @@ to work in every virtual environment." (defun pytest--python () "Find the python executable." - (if (f-absolute? pytest-python-executable) + (if (file-name-absolute-p pytest-python-executable) pytest-python-executable (executable-find pytest-python-executable)))