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

Use dedicated DISABLED() function to disable tests in Python test framework #5792

Merged
merged 2 commits into from
Jul 13, 2023

Conversation

grom72
Copy link
Contributor

@grom72 grom72 commented Jul 10, 2023

This change is Reviewable

@grom72 grom72 added the QA: CI .github/ and utils/ related to automated testing label Jul 10, 2023
@grom72 grom72 added this to the 2.0.0 milestone Jul 10, 2023
@grom72 grom72 requested review from janekmi and osalyk July 10, 2023 20:39
@codecov
Copy link

codecov bot commented Jul 10, 2023

Codecov Report

Merging #5792 (449cf30) into master (91711db) will decrease coverage by 2.25%.
The diff coverage is n/a.

❗ Current head 449cf30 differs from pull request most recent head 8b9b4fb. Consider uploading reports for the commit 8b9b4fb to get more accurate results

@@            Coverage Diff             @@
##           master    #5792      +/-   ##
==========================================
- Coverage   70.98%   68.74%   -2.25%     
==========================================
  Files         131      131              
  Lines       19175    19677     +502     
  Branches     3193     3259      +66     
==========================================
- Hits        13612    13527      -85     
- Misses       5563     6150     +587     

Copy link
Contributor

@janekmi janekmi left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 4 files at r1, all commit messages.
Reviewable status: 3 of 5 files reviewed, 2 unresolved discussions (waiting on @grom72 and @osalyk)


src/test/unittest/basetest.py line 149 at r2 (raw file):

    """
    enabled = True
    disabled = False

Having both these variables next to each other worries me a bit.
Why do we need both of them?
I guess for some reason disabled = True is not an equivalent of enabled = False?


src/test/unittest/utils.py line 30 at r2 (raw file):

def DISABLED(**kwargs):
    """
    DISABLE given test.

Suggestion:

    DISABLE a given test.

@grom72 grom72 force-pushed the test-py-disable branch 2 times, most recently from db534dd to 449cf30 Compare July 11, 2023 09:03
Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 of 5 files reviewed, 2 unresolved discussions (waiting on @janekmi and @osalyk)


src/test/unittest/basetest.py line 149 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Having both these variables next to each other worries me a bit.
Why do we need both of them?
I guess for some reason disabled = True is not an equivalent of enabled = False?

enabled = False is used for silently disabling tests that:

In both cases, we do not want to see any messages.
A different situation is in the case of disabled = True, where we explicitly disable the test and want to follow this fact in the log.


src/test/unittest/utils.py line 30 at r2 (raw file):

def DISABLED(**kwargs):
    """
    DISABLE given test.

Done.

Copy link
Contributor

@osalyk osalyk left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 4 files at r1, 3 of 4 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @janekmi)

@grom72 grom72 added the sprint goal This pull request is part of the ongoing sprint label Jul 13, 2023
Copy link
Contributor

@janekmi janekmi left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 4 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @grom72)


src/test/unittest/basetest.py line 149 at r2 (raw file):

Previously, grom72 (Tomasz Gromadzki) wrote…

enabled = False is used for silently disabling tests that:

In both cases, we do not want to see any messages.
A different situation is in the case of disabled = True, where we explicitly disable the test and want to follow this fact in the log.

Got it. But TBH as a casual user of this framework I would prefer to see a message when a test I requested to be run skips no matter the reason. Otherwise, as a user, I am left with no clue whatsoever. Just a thought.


src/test/unittest/basetest.py line 148 at r4 (raw file):

        force_disabling (bool): True if test is explicitle excluded from
            execution e.g. in case of permanent failing test.
            Defaults to False.

Suggestion:

        force_disabling (bool): True if the test is explicitly excluded from
            execution e.g. in case the test fails permanently.
            Defaults to False.

src/test/unittest/basetest.py line 152 at r4 (raw file):

    """
    enabled = True
    force_disabling = False

I would prefer to call it force_disabled. Especially the rest of the code follows the "disabled" scheme.

DISABLED() decorator is used to disable permanently failing tests until
the fix is prepared.

Signed-off-by: Tomasz Gromadzki <tomasz.gromadzki@intel.com>
Signed-off-by: Tomasz Gromadzki <tomasz.gromadzki@intel.com>
Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 4 files at r5, 1 of 1 files at r6.
Reviewable status: 4 of 5 files reviewed, 1 unresolved discussion (waiting on @janekmi and @osalyk)


src/test/unittest/basetest.py line 149 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Got it. But TBH as a casual user of this framework I would prefer to see a message when a test I requested to be run skips no matter the reason. Otherwise, as a user, I am left with no clue whatsoever. Just a thought.

I think that in the case of require_command, we can use SKIP-base solution or even explicitly fail as we do with Valgrind
But what can we do with unsupported architecture?
Shall we skip it, or shall we remove it at all?
I propose to move this discussion to a separate PR.


src/test/unittest/basetest.py line 148 at r4 (raw file):

        force_disabling (bool): True if test is explicitle excluded from
            execution e.g. in case of permanent failing test.
            Defaults to False.

Done


src/test/unittest/basetest.py line 152 at r4 (raw file):

Previously, janekmi (Jan Michalski) wrote…

I would prefer to call it force_disabled. Especially the rest of the code follows the "disabled" scheme.

Done.

Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 4 files at r5.
Reviewable status: all files reviewed (commit messages unreviewed), 1 unresolved discussion (waiting on @janekmi)

Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

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

Reviewed all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @janekmi)

Copy link
Contributor

@janekmi janekmi left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 4 files at r5, 1 of 1 files at r6, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @grom72)

@janekmi janekmi merged commit 8f1c1e0 into pmem:master Jul 13, 2023
@grom72 grom72 deleted the test-py-disable branch October 24, 2023 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QA: CI .github/ and utils/ related to automated testing sprint goal This pull request is part of the ongoing sprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants