Skip to content

[Refactoring] Add variables for skip decorators - #684

Merged
PokhodenkoSA merged 14 commits into
masterfrom
spokhode/enh/tests
Dec 6, 2021
Merged

PokhodenkoSA merged 14 commits into
masterfrom
spokhode/enh/tests

Conversation

@PokhodenkoSA

@PokhodenkoSA PokhodenkoSA commented Nov 23, 2021 •

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown

@oleksandr-pavlyk oleksandr-pavlyk left a comment

Copy link
Copy Markdown
Contributor

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

PokhodenkoSA commented Nov 23, 2021 •

Copy link
Copy Markdown
Contributor Author

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

@PokhodenkoSA

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

PokhodenkoSA commented Nov 24, 2021 •

Copy link
Copy Markdown
Contributor Author

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

@oleksandr-pavlyk oleksandr-pavlyk left a comment

Copy link
Copy Markdown
Contributor

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

coveralls commented Dec 1, 2021 •

Copy link
Copy Markdown
Collaborator

Coverage Status

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

Comment thread CHANGELOG.md Resolved
@PokhodenkoSA

PokhodenkoSA commented Dec 1, 2021 •

Copy link
Copy Markdown
Contributor Author

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

@oleksandr-pavlyk oleksandr-pavlyk left a comment

Copy link
Copy Markdown
Contributor

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

PokhodenkoSA commented Dec 3, 2021 •

Copy link
Copy Markdown
Contributor Author

Please squash all commits into 1

You mean squash and force push to the same branch?

@oleksandr-pavlyk

Copy link
Copy Markdown
Contributor

Or squash when merging, net effect is the same

@PokhodenkoSA

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

github-actions Bot commented Dec 6, 2021

Copy link
Copy Markdown

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