Repository navigation
[Refactoring] Add variables for skip decorators - #684
Conversation
|
View rendered docs @ https://intelpython.github.io/dpctl/pulls/684/index.html |
oleksandr-pavlyk
left a comment
There was a problem hiding this comment.
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? |
oleksandr-pavlyk
left a comment
There was a problem hiding this comment.
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. |
oleksandr-pavlyk
left a comment
There was a problem hiding this comment.
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.