Skip to content

[Refactoring] Add variables for skip decorators #684

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

Merged
merged 14 commits into from
Dec 6, 2021

Conversation

PokhodenkoSA
Copy link
Contributor

@PokhodenkoSA PokhodenkoSA commented Nov 23, 2021

It could be reused in other tests.
Branch based on #678.

@github-actions
Copy link

Copy link
Contributor

@oleksandr-pavlyk oleksandr-pavlyk left a comment

Choose a reason for hiding this comment

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

Why not move definitions of these decorators to _helper.py

This is where has_gpu, etc are defined anyway.

@PokhodenkoSA
Copy link
Contributor Author

PokhodenkoSA commented Nov 23, 2021

Moving skips variables to common place and reuse is the next step.

@PokhodenkoSA
Copy link
Contributor Author

Also pytest can skip the whole module if some clause not satisfied (example):

pytestmark = pytest.mark.skipif(
    not shutil.which("gdb-oneapi"),
    reason="Intel® Distribution for GDB* is not available",
)

@PokhodenkoSA
Copy link
Contributor Author

Why not move

If you agree that this style improves tests, then I will keep this style in my new code.

@oleksandr-pavlyk
Copy link
Contributor

Saving decorators as variables makes it more readable, but we are using programmatic way to skip tests based on try/except constructs in newer code, e.g.:

try:
   q = dpctl.SyclQueue("cpu")
except dpctl.SyclQueueCreationError:
   pytest.skip("CPU queue could not be constructed")

@PokhodenkoSA
Copy link
Contributor Author

PokhodenkoSA commented Nov 24, 2021

we are using programmatic way to skip tests based on try/except constructs in newer code

This also could be checked in skip decorator. And this skip decorator could be transformed to variable.

@oleksandr-pavlyk
Copy link
Contributor

This also could be checked in skip decorator. And this skip decorator could be transformed to variable.

It could, but use of decorator forces one to create a queue for the sake of checking in decorator, throw it away only to recreate it again in the body of the test.

@PokhodenkoSA
Copy link
Contributor Author

throw it away only to recreate it again in the body of the test

It seems like a preliminary optimization. Why we need it?
We need to skip tests if we can not do some things. Moreover we will be able to do it on the level of module and only once. So it will be faster, just require reordering code in modules.

Copy link
Contributor

@oleksandr-pavlyk oleksandr-pavlyk left a comment

Choose a reason for hiding this comment

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

This PR has become mangled, I am rescinding my approval until this is resolved, or PR is split into smaller chunks.

@coveralls
Copy link
Collaborator

coveralls commented Dec 1, 2021

Coverage Status

Coverage remained the same at 81.32% when pulling 444aa0b on spokhode/enh/tests into 439c2f4 on master.

@PokhodenkoSA
Copy link
Contributor Author

PokhodenkoSA commented Dec 1, 2021

Fixed PR mangling: merge w/ master and target to master.

Copy link
Contributor

@oleksandr-pavlyk oleksandr-pavlyk left a comment

Choose a reason for hiding this comment

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

Please squash all commits into 1, since all the changes affect single file.

@PokhodenkoSA
Copy link
Contributor Author

PokhodenkoSA commented Dec 3, 2021

Please squash all commits into 1

You mean squash and force push to the same branch?

@oleksandr-pavlyk
Copy link
Contributor

Or squash when merging, net effect is the same

@PokhodenkoSA
Copy link
Contributor Author

net effect is the same

I think it is not the same. I will squash to one commit and you apply Create a merge commit. It will create 2 commits on target branch.
squash when merging will create only 1 commit on target branch.

@PokhodenkoSA PokhodenkoSA merged commit 99aba3b into master Dec 6, 2021
@github-actions
Copy link

github-actions bot commented Dec 6, 2021

Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞

@diptorupd diptorupd deleted the spokhode/enh/tests branch December 6, 2021 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants