Skip to content

Commit

Permalink
CI: tweak docstring test to avoid repr issues on some system
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Jun 22, 2024
1 parent cc48c36 commit f7c7d5c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
import builtins
from subprocess import check_call

import pytest
Expand Down Expand Up @@ -453,3 +454,18 @@ def check_array(array, exp_halo, exp_shape, rotate=False):

assert tuple(array.halo) == exp_halo
assert tuple(shape) == tuple(exp_shape)


# Custom display hook that uses __str__ to avoid docstring test issues
def custom_display_hook(value):
if value is not None:
builtins._ = value
print(str(value))


@pytest.fixture(scope='session', autouse=True)
def use_str_display_hook():
original_display_hook = sys.displayhook
sys.displayhook = custom_display_hook
yield
sys.displayhook = original_display_hook # Restore original display hook after tests
2 changes: 1 addition & 1 deletion examples/seismic/tutorials/09_viscoelastic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@
}
],
"source": [
"np.mod(time_range.num,2)"
"int(np.mod(time_range.num,2))"
]
},
{
Expand Down

0 comments on commit f7c7d5c

Please sign in to comment.