Skip to content

Add --only-rerun flag to add option to rerun specific errors#113

Merged
gnikonorov merged 7 commits intopytest-dev:masterfrom
gnikonorov:issue_101
Jul 17, 2020
Merged

Add --only-rerun flag to add option to rerun specific errors#113
gnikonorov merged 7 commits intopytest-dev:masterfrom
gnikonorov:issue_101

Conversation

@gnikonorov
Copy link
Copy Markdown
Member

Add new flag --only-rerun to allow for users to only rerun errors matching regexes passed to this flag. If the flag is omitted or passed in without a value then no changes occur and all failures are rerun.

Closes #101

@gnikonorov gnikonorov requested a review from icemac July 14, 2020 05:03
@gnikonorov gnikonorov self-assigned this Jul 14, 2020
@gnikonorov gnikonorov changed the title Issue 101 Add --only-rerun flag to add option to rerun specific errors Jul 14, 2020
Copy link
Copy Markdown
Contributor

@icemac icemac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but see the question I had.

Comment thread pytest_rerunfailures.py Outdated
@gnikonorov
Copy link
Copy Markdown
Member Author

I updated this PR according to your feedback @icemac

Copy link
Copy Markdown
Contributor

@icemac icemac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still LGTM.

Additionally mentioning this new feature in the readme and changeling would be nice.
Feel free to merge. Do you need a release containing this fix?

Comment thread test_pytest_rerunfailures.py Outdated
@gnikonorov
Copy link
Copy Markdown
Member Author

Thank you. I'll merge this, and open a a PR for the README and changelog.

There's no rush for a release, thank you for asking.

@gnikonorov
Copy link
Copy Markdown
Member Author

Added the README and changelog changes here, since it doesn't make sense to do otherwise. Thanks for reminding me @icemac. Please let me know if you're still comfortable with me merging these changes

Copy link
Copy Markdown
Contributor

@icemac icemac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am impressed. Thank you for the good documentation.

@gnikonorov gnikonorov merged commit c564938 into pytest-dev:master Jul 17, 2020
Copy link
Copy Markdown
Member

@sallner sallner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the PR very much, thank you for your work!

Comment thread pytest_rerunfailures.py


def _should_hard_fail_on_error(session_config, report):
if report.outcome != 'failed':
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me, that this test is also done in line 230 with report.failed or am I missing some edge case here? Which test case would fail, if we leave it out?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated since it says that anything that is not failed cannot be a hard failure. Which makes sense to me, since otherwise this function would potentially flag non failed things as hard failures

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the reason but I do not see, why we need it twice currently. It seems to be a guard for a case, that is not possible at the moment. But I would like to refactor line 230 anyhow, as this is not so easy to comprehend any more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m working on this issue and in the change I have a refactor of that line.

This change came out of it. It’s just unrelated, so I raised it first.

@graingert
Copy link
Copy Markdown
Member

@S-Borkowski 9.0...master

@S-Borkowski
Copy link
Copy Markdown

S-Borkowski commented Aug 24, 2020

@gnikonorov When I run it like this (PreSubmitError is my user-defined exception):

pytest -n auto --dist loadscope --reruns 3 --only-rerun PreSubmitError pathToTest

I get and error: pytest: error: unrecognised arguments: --only-rerun pathToTest

@The-Compiler
Copy link
Copy Markdown
Member

@S-Borkowski Do you actually install pytest-rerunfailures from git master?

@S-Borkowski
Copy link
Copy Markdown

S-Borkowski commented Aug 24, 2020

@The-Compiler Downloaded version 9.0 (most recent) from pypi. I am unable to install packages through console; i need .whl file to install

@The-Compiler
Copy link
Copy Markdown
Member

@S-Borkowski 9.0 was released on March 18th, this PR was merged on July 17th. You'll need to either find a way to install from the git repository, or wait until the next release.

@S-Borkowski
Copy link
Copy Markdown

@The-Compiler When will approx. be the next release? Is there any way You could provide me with .whl of July's version?

@The-Compiler
Copy link
Copy Markdown
Member

@S-Borkowski Here's the result of running python3 setup.py bdist_wheel in this repo:
pytest_rerunfailures-9.1.dev0-py3-none-any.zip - rename it from .zip to .whl to use it. I haven't tested it in any way, so use it on your own risk.

No idea when a new release is planned - that's up to the maintainers to decide.

@sallner
Copy link
Copy Markdown
Member

sallner commented Aug 24, 2020

@S-Borkowski @The-Compiler I had setup a milestone with some Tickets to be solved before a 9.1 release. In case you definitely need it quickly, I could cut a release tomorrow and move the remaining issues to a 9.2 release.

@S-Borkowski
Copy link
Copy Markdown

@sallner If it won't mess with Your work flow much, I would love that!

@S-Borkowski
Copy link
Copy Markdown

@sallner Please let me know what was your decision, and when i can expect 9.1 release :)

@sallner
Copy link
Copy Markdown
Member

sallner commented Aug 26, 2020

@S-Borkowski @The-Compiler I have just released version 9.1 of this package. Feel free to use it. https://pypi.org/project/pytest-rerunfailures/9.1/

@S-Borkowski
Copy link
Copy Markdown

@sallner <3

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

Successfully merging this pull request may close these issues.

Rerun only for certain errors?

6 participants