-
Notifications
You must be signed in to change notification settings - Fork 30
[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
Conversation
View rendered docs @ https://intelpython.github.io/dpctl/pulls/684/index.html |
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.
Why not move definitions of these decorators to _helper.py
This is where has_gpu
, etc are defined anyway.
Moving skips variables to common place and reuse is the next step. |
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",
) |
If you agree that this style improves tests, then I will keep this style in my new code. |
Saving decorators as variables makes it more readable, but we are using programmatic way to skip tests based on try:
q = dpctl.SyclQueue("cpu")
except dpctl.SyclQueueCreationError:
pytest.skip("CPU queue could not be constructed") |
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. |
It seems like a preliminary optimization. Why we need it? |
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.
This PR has become mangled, I am rescinding my approval until this is resolved, or PR is split into smaller chunks.
Fixed PR mangling: merge w/ master and target to master. |
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.
Please squash all commits into 1, since all the changes affect single file.
You mean squash and force push to the same branch? |
Or squash when merging, net effect is the same |
I think it is not the same. I will squash to one commit and you apply |
Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞 |
It could be reused in other tests.
Branch based on #678.