-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
072b2e1
commit c9bf659
Showing
3 changed files
with
50 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
import pytest | ||
import os | ||
|
||
@pytest.fixture(scope='session', autouse=True) | ||
def monkeypatch_cpuinfo(monkeypatch): | ||
# only patch on github actions | ||
if "CI" not in os.environ or not os.environ["CI"] or "GITHUB_RUN_ID" not in os.environ: | ||
return | ||
|
||
def patched_cpuinfo() -> dict: | ||
return {} | ||
|
||
import cpuinfo | ||
monkeypatch.setattr(cpuinfo, 'get_cpu_info', patched_cpuinfo) | ||
|
||
import blosc2.core | ||
monkeypatch.setattr(blosc2.core, 'get_cpu_info', patched_cpuinfo) | ||
def on_gh_actions() -> bool: | ||
return "CI" in os.environ or os.environ["CI"] or "GITHUB_RUN_ID" in os.environ | ||
|
||
@pytest.fixture(autouse=True) | ||
def monkeypatch_cpuinfo(mocker): | ||
# only patch on github actions | ||
# if not on_gh_actions(): | ||
# return | ||
|
||
# def patched_cpuinfo() -> dict: | ||
# return {} | ||
# | ||
# class PatchedModule(): | ||
# get_cpu_info = patched_cpuinfo | ||
# | ||
# import cpuinfo | ||
# monkeypatch.setattr(cpuinfo, 'get_cpu_info', patched_cpuinfo) | ||
# | ||
# import blosc2.core | ||
# monkeypatch.setattr(blosc2.core, 'get_cpu_info', patched_cpuinfo) | ||
# | ||
# import tables.leaf | ||
# monkeypatch.setattr(tables.leaf, 'cpuinfo', PatchedModule) | ||
|
||
mocker.patch('cpuinfo.get_cpu_info', return_value={}) | ||
mocker.patch('blosc2.core.get_cpu_info', return_value={}) | ||
mocker.patch('tables.leaf.cpuinfo.get_cpu_info', return_value={}) | ||
|
||
|
||
|