-
Notifications
You must be signed in to change notification settings - Fork 88
condition can be evaluated in the real time #162
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
Conversation
@15klli Thank you for this PR. It currently fails when running the tests, could you please fix it. |
ok, I will fix them. |
213f122
to
5e5a800
Compare
I fix them by coping the @pytest.mark.flaky(condition="non_empty",reruns=2)
def test_demo():
assert False The above testcase will rerun 2 times(condition means True) with the front version but will fail and get error with the version having this feature, since it doesn't define But I believe almost no one will write "non_empty" string instead of writing |
@icemac Hello, can you review it when you are free? |
@15klli Currently the linter complains. Could you please fix these issues, too? |
5e5a800
to
44dea8e
Compare
use the skipping.evaluate_condition from pytest in order to keep the same behavior with pytest.mark.skipif. It evaluates the condition in real time so that we can decide whether the case should be rerun in runtime Change-Id: I2575d368c79480223c84498513a4ef605db0c576
44dea8e
to
bbc101d
Compare
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thank you for this PR. 😃 |
Sorry for being late to the party. But there is still a changelog entry missing. And with this change in the condition parsing, it actually is a backwards incompatible change. @15klli what is the prospect of the copied code? As far as I understand the refactoring in pytest-dev/pytest#7388 it is include in pytest versions >= 6.0. That would be something to note at the code. |
The reasons why I copied the code instead of referring to the
That's why copied the code though I know it is not a graceful way. |
I added a change log entry in 138db6c. |
@icemac when will you package it and upload to |
@15klli I just released https://pypi.org/project/pytest-rerunfailures/10.1/ |
@sallner Could you please fix the still open issues directly on |
4926: Bump pytest-rerunfailures from 10.3 to 11.0 r=jenshnielsen a=dependabot[bot] Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) from 10.3 to 11.0. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst">pytest-rerunfailures's changelog</a>.</em></p> <blockquote> <h2>11.0 (unreleased)</h2> <p>Breaking changes ++++++++++++++++</p> <ul> <li> <p>Drop support for Python 3.6.</p> </li> <li> <p>Drop support for pytest < 6.</p> </li> </ul> <p>Bug fixes +++++++++</p> <ul> <li> <p>Fix crash when pytest-xdist is installed but disabled. (Thanks to <code>`@mgorny` <https://github.com/mgorny></code>_ for the PR.)</p> </li> <li> <p>Fix crash when xfail(strict=True) mark is used with --rerun-only flag.</p> </li> </ul> <p>Features ++++++++</p> <ul> <li> <p>Added option <code>--rerun-except</code> to rerun failed tests those are other than the mentioned Error.</p> </li> <li> <p>Add support for Python 3.11.</p> </li> <li> <p>Add support for pytest 7.0, 7.1, 7.2.</p> </li> </ul> <h2>10.2 (2021-09-17)</h2> <p>Features ++++++++</p> <ul> <li>Allow recovery from crashed tests with pytest-xdist.</li> <li>Add support for Python 3.10 (as of Python 3.10.rc2). (Thanks to <code>`@hugovk` <https://github.com/hugovk></code>_ for the PR.)</li> </ul> <h2>10.1 (2021-07-02)</h2> <p>Features ++++++++</p> <ul> <li>Allows using a <code>str</code> as condition for <code>`@pytest.mark.flaky(condition)</code>` which gets evaluated dynamically similarly to <code>`@pytest.mark.skipif(condition)</code>.` (<code>[#162](pytest-dev/pytest-rerunfailures#162) <https://github.com/pytest-dev/pytest-rerunfailures/pull/162></code>_</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/pytest-dev/pytest-rerunfailures/commit/4dc493befc4323310b568e461ad184881c0459d1"><code>4dc493b</code></a> Preparing release 11.0</li> <li><a href="https://github.com/pytest-dev/pytest-rerunfailures/commit/3ffda7fad457fd6518915d0c2806b26566ba2b73"><code>3ffda7f</code></a> fix: don't bind all ips (<a href="https://github-redirect.dependabot.com/pytest-dev/pytest-rerunfailures/issues/201">#201</a>)</li> <li><a href="https://github.com/pytest-dev/pytest-rerunfailures/commit/737183cb61c279292ed3a19c0b4655e64b0b4040"><code>737183c</code></a> Update dependencies: (<a href="https://github-redirect.dependabot.com/pytest-dev/pytest-rerunfailures/issues/202">#202</a>)</li> <li>See full diff in <a href="https://github.com/pytest-dev/pytest-rerunfailures/compare/10.3...11.0">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) You can trigger a rebase of this PR by commenting ``@dependabot` rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - ``@dependabot` rebase` will rebase this PR - ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it - ``@dependabot` merge` will merge this PR after your CI passes on it - ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it - ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging - ``@dependabot` reopen` will reopen this PR if it is closed - ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
4923: Move VoltageDivider into parameters and deprecate r=jenshnielsen a=jenshnielsen This is not an instrument but a Parameter so it makes more sense for it to live there. Since DelegateParamerer does the same more general and better deprecate this one 4926: Bump pytest-rerunfailures from 10.3 to 11.0 r=jenshnielsen a=dependabot[bot] Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) from 10.3 to 11.0. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst">pytest-rerunfailures's changelog</a>.</em></p> <blockquote> <h2>11.0 (unreleased)</h2> <p>Breaking changes ++++++++++++++++</p> <ul> <li> <p>Drop support for Python 3.6.</p> </li> <li> <p>Drop support for pytest < 6.</p> </li> </ul> <p>Bug fixes +++++++++</p> <ul> <li> <p>Fix crash when pytest-xdist is installed but disabled. (Thanks to <code>`@mgorny` <https://github.com/mgorny></code>_ for the PR.)</p> </li> <li> <p>Fix crash when xfail(strict=True) mark is used with --rerun-only flag.</p> </li> </ul> <p>Features ++++++++</p> <ul> <li> <p>Added option <code>--rerun-except</code> to rerun failed tests those are other than the mentioned Error.</p> </li> <li> <p>Add support for Python 3.11.</p> </li> <li> <p>Add support for pytest 7.0, 7.1, 7.2.</p> </li> </ul> <h2>10.2 (2021-09-17)</h2> <p>Features ++++++++</p> <ul> <li>Allow recovery from crashed tests with pytest-xdist.</li> <li>Add support for Python 3.10 (as of Python 3.10.rc2). (Thanks to <code>`@hugovk` <https://github.com/hugovk></code>_ for the PR.)</li> </ul> <h2>10.1 (2021-07-02)</h2> <p>Features ++++++++</p> <ul> <li>Allows using a <code>str</code> as condition for <code>`@pytest.mark.flaky(condition)</code>` which gets evaluated dynamically similarly to <code>`@pytest.mark.skipif(condition)</code>.` (<code>[#162](pytest-dev/pytest-rerunfailures#162) <https://github.com/pytest-dev/pytest-rerunfailures/pull/162></code>_</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/pytest-dev/pytest-rerunfailures/commit/4dc493befc4323310b568e461ad184881c0459d1"><code>4dc493b</code></a> Preparing release 11.0</li> <li><a href="https://github.com/pytest-dev/pytest-rerunfailures/commit/3ffda7fad457fd6518915d0c2806b26566ba2b73"><code>3ffda7f</code></a> fix: don't bind all ips (<a href="https://github-redirect.dependabot.com/pytest-dev/pytest-rerunfailures/issues/201">#201</a>)</li> <li><a href="https://github.com/pytest-dev/pytest-rerunfailures/commit/737183cb61c279292ed3a19c0b4655e64b0b4040"><code>737183c</code></a> Update dependencies: (<a href="https://github-redirect.dependabot.com/pytest-dev/pytest-rerunfailures/issues/202">#202</a>)</li> <li>See full diff in <a href="https://github.com/pytest-dev/pytest-rerunfailures/compare/10.3...11.0">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) You can trigger a rebase of this PR by commenting ``@dependabot` rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - ``@dependabot` rebase` will rebase this PR - ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it - ``@dependabot` merge` will merge this PR after your CI passes on it - ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it - ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging - ``@dependabot` reopen` will reopen this PR if it is closed - ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Co-authored-by: Jens H. Nielsen <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
4926: Bump pytest-rerunfailures from 10.3 to 11.0 r=jenshnielsen a=dependabot[bot] Bumps [pytest-rerunfailures](https://github.com/pytest-dev/pytest-rerunfailures) from 10.3 to 11.0. <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/pytest-dev/pytest-rerunfailures/blob/master/CHANGES.rst">pytest-rerunfailures's changelog</a>.</em></p> <blockquote> <h2>11.0 (unreleased)</h2> <p>Breaking changes ++++++++++++++++</p> <ul> <li> <p>Drop support for Python 3.6.</p> </li> <li> <p>Drop support for pytest < 6.</p> </li> </ul> <p>Bug fixes +++++++++</p> <ul> <li> <p>Fix crash when pytest-xdist is installed but disabled. (Thanks to <code>`@mgorny` <https://github.com/mgorny></code>_ for the PR.)</p> </li> <li> <p>Fix crash when xfail(strict=True) mark is used with --rerun-only flag.</p> </li> </ul> <p>Features ++++++++</p> <ul> <li> <p>Added option <code>--rerun-except</code> to rerun failed tests those are other than the mentioned Error.</p> </li> <li> <p>Add support for Python 3.11.</p> </li> <li> <p>Add support for pytest 7.0, 7.1, 7.2.</p> </li> </ul> <h2>10.2 (2021-09-17)</h2> <p>Features ++++++++</p> <ul> <li>Allow recovery from crashed tests with pytest-xdist.</li> <li>Add support for Python 3.10 (as of Python 3.10.rc2). (Thanks to <code>`@hugovk` <https://github.com/hugovk></code>_ for the PR.)</li> </ul> <h2>10.1 (2021-07-02)</h2> <p>Features ++++++++</p> <ul> <li>Allows using a <code>str</code> as condition for <code>`@pytest.mark.flaky(condition)</code>` which gets evaluated dynamically similarly to <code>`@pytest.mark.skipif(condition)</code>.` (<code>[#162](pytest-dev/pytest-rerunfailures#162) <https://github.com/pytest-dev/pytest-rerunfailures/pull/162></code>_</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/pytest-dev/pytest-rerunfailures/commit/4dc493befc4323310b568e461ad184881c0459d1"><code>4dc493b</code></a> Preparing release 11.0</li> <li><a href="https://github.com/pytest-dev/pytest-rerunfailures/commit/3ffda7fad457fd6518915d0c2806b26566ba2b73"><code>3ffda7f</code></a> fix: don't bind all ips (<a href="https://github-redirect.dependabot.com/pytest-dev/pytest-rerunfailures/issues/201">#201</a>)</li> <li><a href="https://github.com/pytest-dev/pytest-rerunfailures/commit/737183cb61c279292ed3a19c0b4655e64b0b4040"><code>737183c</code></a> Update dependencies: (<a href="https://github-redirect.dependabot.com/pytest-dev/pytest-rerunfailures/issues/202">#202</a>)</li> <li>See full diff in <a href="https://github.com/pytest-dev/pytest-rerunfailures/compare/10.3...11.0">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) You can trigger a rebase of this PR by commenting ``@dependabot` rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - ``@dependabot` rebase` will rebase this PR - ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it - ``@dependabot` merge` will merge this PR after your CI passes on it - ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it - ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging - ``@dependabot` reopen` will reopen this PR if it is closed - ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
use the skipping.evaluate_condition from pytest in order to keep the same behavior with pytest.mark.skipif. It evaluates the condition in real time so that we can decide whether the case should be rerun in runtime
Change-Id: I2575d368c79480223c84498513a4ef605db0c576