Skip to content
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

condition can be evaluated in the real time #162

Merged
merged 1 commit into from
Jun 29, 2021

Conversation

15klli
Copy link

@15klli 15klli commented Jun 18, 2021

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

@15klli 15klli marked this pull request as draft June 18, 2021 09:38
@15klli 15klli marked this pull request as ready for review June 18, 2021 09:38
@icemac
Copy link
Contributor

icemac commented Jun 22, 2021

@15klli Thank you for this PR. It currently fails when running the tests, could you please fix it.

@15klli
Copy link
Author

15klli commented Jun 22, 2021

@15klli Thank you for this PR. It currently fails when running the tests, could you please fix it.

ok, I will fix them.

@15klli
Copy link
Author

15klli commented Jun 23, 2021

I fix them by coping the evaluate_condition from skipping.py(python3.8.10), and all check passed in my PC. And I have to remind that this feature has compatible problem like the following:

@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 non_empty.

But I believe almost no one will write "non_empty" string instead of writing True directly so that the case will always rerun if failed.

@15klli
Copy link
Author

15klli commented Jun 25, 2021

@icemac Hello, can you review it when you are free?

@icemac
Copy link
Contributor

icemac commented Jun 28, 2021

@15klli Currently the linter complains. Could you please fix these issues, too?

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
@15klli
Copy link
Author

15klli commented Jun 29, 2021

@15klli Currently the linter complains. Could you please fix these issues, too?

Done.

Copy link
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.

@icemac icemac merged commit e0e5ba3 into pytest-dev:master Jun 29, 2021
@icemac
Copy link
Contributor

icemac commented Jun 29, 2021

Thank you for this PR. 😃

@sallner
Copy link
Member

sallner commented Jun 29, 2021

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.

@15klli
Copy link
Author

15klli commented Jun 30, 2021

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 skipping.evaluate_condition are that:

  1. The low version pytest doesn't have such function
  2. The higher version pytest will throw a exception if the marker doesn't have the reason value which is required by skipif marker

That's why copied the code though I know it is not a graceful way.
Does That would be something to note at the code mean that I should write the note into the python code?

@icemac
Copy link
Contributor

icemac commented Jul 1, 2021

I added a change log entry in 138db6c.

@15klli 15klli deleted the condition_canbe_str branch July 2, 2021 08:25
@15klli
Copy link
Author

15klli commented Jul 2, 2021

@icemac when will you package it and upload to pypi.org ? I want to apply this feature on my project.

@icemac
Copy link
Contributor

icemac commented Jul 2, 2021

@icemac
Copy link
Contributor

icemac commented Jul 2, 2021

@sallner Could you please fix the still open issues directly on master? Sorry for being too quick to merge the PR.

bors bot added a commit to microsoft/Qcodes that referenced this pull request Jan 13, 2023
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 &lt; 6.</p>
</li>
</ul>
<p>Bug fixes
+++++++++</p>
<ul>
<li>
<p>Fix crash when pytest-xdist is installed but disabled.
(Thanks to <code>`@mgorny` &lt;https://github.com/mgorny&gt;</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` &lt;https://github.com/hugovk&gt;</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) &lt;https://github.com/pytest-dev/pytest-rerunfailures/pull/162&gt;</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 />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pytest-rerunfailures&package-manager=pip&previous-version=10.3&new-version=11.0)](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>
bors bot added a commit to microsoft/Qcodes that referenced this pull request Jan 13, 2023
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 &lt; 6.</p>
</li>
</ul>
<p>Bug fixes
+++++++++</p>
<ul>
<li>
<p>Fix crash when pytest-xdist is installed but disabled.
(Thanks to <code>`@mgorny` &lt;https://github.com/mgorny&gt;</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` &lt;https://github.com/hugovk&gt;</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) &lt;https://github.com/pytest-dev/pytest-rerunfailures/pull/162&gt;</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 />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pytest-rerunfailures&package-manager=pip&previous-version=10.3&new-version=11.0)](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 <Jens.Nielsen@microsoft.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
bors bot added a commit to microsoft/Qcodes that referenced this pull request Jan 13, 2023
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 &lt; 6.</p>
</li>
</ul>
<p>Bug fixes
+++++++++</p>
<ul>
<li>
<p>Fix crash when pytest-xdist is installed but disabled.
(Thanks to <code>`@mgorny` &lt;https://github.com/mgorny&gt;</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` &lt;https://github.com/hugovk&gt;</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) &lt;https://github.com/pytest-dev/pytest-rerunfailures/pull/162&gt;</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 />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pytest-rerunfailures&package-manager=pip&previous-version=10.3&new-version=11.0)](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>
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.

3 participants