File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -282,9 +282,9 @@ def test_watcher_real(qtbot):
282282 manager .show ()
283283
284284 # Start IPython session
285- from IPython .testing .globalipapp import get_ipython
285+ from IPython .testing .globalipapp import start_ipython
286286
287- ip_session : IPython .InteractiveShell = get_ipython ()
287+ ip_session : IPython .InteractiveShell = start_ipython ()
288288
289289 # Load extension
290290 ip_session .run_line_magic ("load_ext" , "erlab.interactive" )
@@ -364,3 +364,4 @@ def test_watcher_real(qtbot):
364364 ip_session .user_ns .clear () # Clear the user namespace
365365
366366 ip_session .clear_instance ()
367+ del start_ipython .already_called
Original file line number Diff line number Diff line change 1+ from typing import TYPE_CHECKING
2+
13import pytest
24import xarray as xr
35
46import erlab
57
8+ if TYPE_CHECKING :
9+ import IPython
10+
611
712@pytest .fixture (scope = "module" )
813def data_dir (test_data_dir ):
@@ -26,8 +31,16 @@ def expected_dir(data_dir):
2631 ],
2732)
2833def test_load (expected_dir , args , expected ) -> None :
34+ # Start IPython session to avoid astropy logging issues
35+ from IPython .testing .globalipapp import start_ipython
36+
37+ ip_session : IPython .InteractiveShell = start_ipython ()
38+
2939 loaded = erlab .io .load (** args ) if isinstance (args , dict ) else erlab .io .load (args )
3040
3141 xr .testing .assert_identical (
3242 loaded , xr .load_dataarray (expected_dir / expected , engine = "h5netcdf" )
3343 )
44+ # Properly clean up the IPython session
45+ ip_session .clear_instance ()
46+ del start_ipython .already_called
You can’t perform that action at this time.
0 commit comments