You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to run the Live Viewer eyes tests locally without running other eyes tests, the tests fail due to the fake file system.
Steps To Reproduce
In either Linux or Windows, run make test-screenshots or make tests-screenshots-win where the directory to search for tests is set to the live viewer tests. I.e. edit the Makefile such that:
Then run make test-screenshots or make tests-screenshots-win.
Current Behaviour
All tests fail
Expected Behaviour
Live Viewer eyes tests should be able to run independent of the other eyes tests. This way we don't have to run all eyes tests just to test the Live Viewer.
Failure Logs
(mantidimaging-dev) C:\Users\ddb29996\mantidimaging>make test-screenshots-win
mkdir C:\Users\ddb29996\AppData\Local\Temp\mantidimaging_tests
A subdirectory or file C:\Users\ddb29996\AppData\Local\Temp\mantidimaging_tests already exists.
make: [Makefile:60: test-screenshots-win] Error 1 (ignored)
pytest -p no:xdist -p no:randomly -p no:cov mantidimaging/eyes_tests/live_viewer_window_test.py -vs --run-eyes-tests
======================================================= test session starts =======================================================
platform win32 -- Python 3.12.8, pytest-7.4.4, pluggy-1.5.0 -- C:\Users\ddb29996\AppData\Local\miniforge3\envs\mantidimaging-dev\python.exe
cachedir: .pytest_cache
rootdir: C:\Users\ddb29996\mantidimaging
plugins: pyfakefs-5.3.5, xdist-3.3.1
collected 4 items
mantidimaging/eyes_tests/live_viewer_window_test.py::LiveViewerWindowTest::test_live_view_opens_with_bad_data (node:33812) ExperimentalWarning: Module._stat is an experimental feature and might change at any time
(Use `core --trace-warnings ...` to show where the warning was created)
(node:33812) ExperimentalWarning: Module._readPackage is an experimental feature and might change at any time
FAILED
mantidimaging/eyes_tests/live_viewer_window_test.py::LiveViewerWindowTest::test_live_view_opens_with_data FAILED
mantidimaging/eyes_tests/live_viewer_window_test.py::LiveViewerWindowTest::test_live_view_opens_without_data FAILED
mantidimaging/eyes_tests/live_viewer_window_test.py::LiveViewerWindowTest::test_rotate_operation_rotates_image FAILED
============================================================ FAILURES =============================================================
_____________________________________ LiveViewerWindowTest.test_live_view_opens_with_bad_data _____________________________________
self = <mantidimaging.eyes_tests.live_viewer_window_test.LiveViewerWindowTest testMethod=test_live_view_opens_with_bad_data>
_mock_time = <MagicMock name='time' id='2438838525088'>, _mock_image_watcher = <MagicMock name='ImageWatcher' id='2438838529552'>
mock_load_image = <MagicMock name='load_image_from_path' id='2438838533200'>
@mock.patch('mantidimaging.gui.windows.live_viewer.presenter.LiveViewerWindowPresenter.load_image_from_path')
@mock.patch('mantidimaging.gui.windows.live_viewer.model.ImageWatcher')
@mock.patch("time.time", return_value=4000.0)
def test_live_view_opens_with_bad_data(self, _mock_time, _mock_image_watcher, mock_load_image):
file_list = self._make_simple_dir(self.live_directory)
image_list = [Image_Data(path) for path in file_list]
mock_load_image.side_effect = ValueError
> self.imaging.show_live_viewer(self.live_directory)
mantidimaging\eyes_tests\live_viewer_window_test.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
mantidimaging\gui\windows\main\view.py:452: in show_live_viewer
live_viewer = LiveViewerWindowView(self, live_data_path)
mantidimaging\gui\windows\live_viewer\view.py:37: in __init__
self.live_viewer = LiveViewWidget()
mantidimaging\gui\windows\live_viewer\live_view_widget.py:32: in __init__
self.image = MIMiniImageView(name="Projection")
mantidimaging\gui\widgets\mi_mini_image_view\view.py:50: in __init__
self.hist = HistogramLUTItem(self.im)
..\AppData\Local\miniforge3\envs\mantidimaging-dev\Lib\site-packages\pyqtgraph\graphicsItems\HistogramLUTItem.py:117: in __init__
self.gradient = GradientEditorItem(orientation=self.gradientPosition)
..\AppData\Local\miniforge3\envs\mantidimaging-dev\Lib\site-packages\pyqtgraph\graphicsItems\GradientEditorItem.py:440: in __init__
self.menu = ColorMapMenu(showGradientSubMenu=True, showColorMapSubMenus=True)
..\AppData\Local\miniforge3\envs\mantidimaging-dev\Lib\site-packages\pyqtgraph\widgets\ColorMapMenu.py:199: in __init__
if find_mpl_leftovers():
..\AppData\Local\miniforge3\envs\mantidimaging-dev\Lib\site-packages\pyqtgraph\widgets\ColorMapMenu.py:78: in find_mpl_leftovers
names = colormap.listMaps(source="matplotlib")
..\AppData\Local\miniforge3\envs\mantidimaging-dev\Lib\site-packages\pyqtgraph\colormap.py:42: in listMaps
import matplotlib.pyplot as mpl_plt
..\AppData\Local\miniforge3\envs\mantidimaging-dev\Lib\site-packages\matplotlib\__init__.py:997: in <module>
rcParamsDefault = _rc_params_in_file(
..\AppData\Local\miniforge3\envs\mantidimaging-dev\Lib\site-packages\matplotlib\__init__.py:903: in _rc_params_in_file
with _open_file_or_url(fname) as fd:
..\AppData\Local\miniforge3\envs\mantidimaging-dev\Lib\contextlib.py:137: in __enter__
return next(self.gen)
..\AppData\Local\miniforge3\envs\mantidimaging-dev\Lib\site-packages\matplotlib\__init__.py:880: in _open_file_or_url
with open(fname, encoding='utf-8') as f:
..\AppData\Local\miniforge3\envs\mantidimaging-dev\Lib\site-packages\pyfakefs\fake_io.py:125: in open
return fake_open(
..\AppData\Local\miniforge3\envs\mantidimaging-dev\Lib\site-packages\pyfakefs\fake_open.py:97: in __call__
return self.call(*args, **kwargs)
..\AppData\Local\miniforge3\envs\mantidimaging-dev\Lib\site-packages\pyfakefs\fake_open.py:199: in call
file_object = self._init_file_object(
..\AppData\Local\miniforge3\envs\mantidimaging-dev\Lib\site-packages\pyfakefs\fake_open.py:282: in _init_file_object
self.filesystem.raise_os_error(errno.ENOENT, file_path)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pyfakefs.fake_filesystem.FakeFilesystem object at 0x00000237D4BE04A0>, err_no = 2
filename = 'C:\\Users\\ddb29996\\AppData\\Local\\miniforge3\\envs\\mantidimaging-dev\\Lib\\site-packages\\matplotlib\\mpl-data\\matplotlibrc'
winerror = None
def raise_os_error(
self,
err_no: int,
filename: Optional[AnyString] = None,
winerror: Optional[int] = None,
) -> NoReturn:
"""Raises OSError.
The error message is constructed from the given error code and shall
start with the error string issued in the real system.
Note: this is not true under Windows if winerror is given - in this
case a localized message specific to winerror will be shown in the
real file system.
Args:
err_no: A numeric error code from the C variable errno.
filename: The name of the affected file, if any.
winerror: Windows only - the specific Windows error code.
"""
message = os.strerror(err_no) + " in the fake filesystem"
if winerror is not None and sys.platform == "win32" and self.is_windows_fs:
raise OSError(err_no, message, filename, winerror)
> raise OSError(err_no, message, filename)
E FileNotFoundError: [Errno 2] No such file or directory in the fake filesystem: 'C:\\Users\\ddb29996\\AppData\\Local\\miniforge3\\envs\\mantidimaging-dev\\Lib\\site-packages\\matplotlib\\mpl-data\\matplotlibrc'
..\AppData\Local\miniforge3\envs\mantidimaging-dev\Lib\site-packages\pyfakefs\fake_filesystem.py:427: FileNotFoundError
The text was updated successfully, but these errors were encountered:
Summary
When attempting to run the Live Viewer eyes tests locally without running other eyes tests, the tests fail due to the fake file system.
Steps To Reproduce
In either Linux or Windows, run
make test-screenshots
ormake tests-screenshots-win
where the directory to search for tests is set to the live viewer tests. I.e. edit the Makefile such that:or
Then run
make test-screenshots
ormake tests-screenshots-win
.Current Behaviour
All tests fail
Expected Behaviour
Live Viewer eyes tests should be able to run independent of the other eyes tests. This way we don't have to run all eyes tests just to test the Live Viewer.
Failure Logs
The text was updated successfully, but these errors were encountered: