question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

References to tests in === FAILURES === report should be suitable as input to select tests.

See original GitHub issue

Hi!

I’d like to be able to quickly retest a certain failing test after running the whole suite. --last-failed provides a similar functionality, but not the same if multiple (or many) tests fail.

Whenever I have failures, the “FAILED/PASSED” lines in the session report lists them in a way that is suitable for input for selecting them for a subsequent run (as outlined in https://docs.pytest.org/en/latest/usage.html#specifying-tests-selecting-tests).

project/package/tests/test_or.py::TestSomeClass::test_some_behaviour FAILED  [  1%]

However when I’m investigating a failure I’m often looking at the backtrace and variables in the === FAILURES === section of pytest’s output:

============================================== FAILURES ==============================================
___________________________ TestSomeClass.test_some_behaviour ____________________________

self = <project.package.tests.test_or.TestSomeClass testMethod=test_some_behaviour>

    def test_some_behaviour(self):
[...]
self       = <project.package.tests.test_or.TestSomeClass testMethod=test_some_behaviour>

project/package/tests/test_or.py:158: AssertionError

And to get the node id of the test in question, I either have to scroll up (quite far, if my testsuite contains over 500 tests) or piece the information together from the output.

I can use the method name test_some_behaviour together with -k but this might execute multiple tests with the same name.

In the concrete example it would be convenient for me if project/package/tests/test_or.py::TestSomeClass::test_some_behaviour would appear somewhere in the FAILURES output.

Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nicoddemuscommented, Jun 11, 2018

Opened #3566 to track adding a blurb about -r to the docs. Thanks for the report @TauPan!

1reaction
nicoddemuscommented, Jun 11, 2018

Hi,

It is shown in some places:

But you are correct that it should be displayed more prominently somewhere.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSTest@2 - Visual Studio Test v2 task - Microsoft Learn
Use this task to run unit and functional tests (Selenium, Appium, Coded UI test, etc.) using the Visual Studio Test (VSTest) runner.
Read more >
How to Write Test Cases: The Ultimate Guide with Examples
A test case has components that describe input, action, and an expected response, in order to determine if a feature of an application...
Read more >
Unit Tests, How to Write Testable Code, and Why It Matters
In this article, I will show that unit testing itself is quite easy; the real problems that complicate unit testing, and introduce expensive...
Read more >
Advanced googletest Topics
This document will show you more assertions as well as how to construct complex failure messages, propagate fatal failures, reuse and speed up...
Read more >
Quality Indicators to Detect Pre-Analytical Errors in Laboratory ...
Quality indicators (QIs) should therefore cover all steps in the pre-analytical phase, from test requesting to sample storage. In the present paper, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found