Skip to content

Commit

Permalink
Update tests for _handle_directory_change changes
Browse files Browse the repository at this point in the history
  • Loading branch information
samtygier-stfc committed Jun 10, 2024
1 parent c49da81 commit 109e384
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mantidimaging/gui/windows/live_viewer/test/model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ def test_WHEN_directory_change_simple_THEN_images_emitted(self):
file_list = self._make_simple_dir(self.top_path)
self.mock_signal_image.emit.assert_not_called()

self.watcher._handle_directory_change(self.top_path)
self.watcher.changed_directory = self.top_path
self.watcher._handle_directory_change()

emitted_images = self._get_recent_emitted_files()
self._file_list_count_equal(emitted_images, file_list)
Expand All @@ -110,7 +111,8 @@ def test_WHEN_directory_change_empty_subdir_THEN_images_emitted(self, _mock_time
os.utime(self.top_path / "empty", [10, 2000])
self.assertLess(self.top_path.stat().st_mtime, (self.top_path / 'empty').stat().st_mtime)

self.watcher._handle_directory_change(self.top_path / "empty")
self.watcher.changed_directory = self.top_path / "empty"
self.watcher._handle_directory_change()

emitted_images = self._get_recent_emitted_files()
self._file_list_count_equal(emitted_images, file_list)
Expand All @@ -123,7 +125,8 @@ def test_WHEN_directory_change_with_subdir_THEN_images_emitted(self, _mock_time)
self.assertLess(self.top_path.stat().st_mtime, (self.top_path / 'more').stat().st_mtime)
self.assertLess((self.top_path / 'more').stat().st_mtime, time.time())

self.watcher._handle_directory_change(self.top_path)
self.watcher.changed_directory = self.top_path
self.watcher._handle_directory_change()

emitted_images = self._get_recent_emitted_files()
self._file_list_count_equal(emitted_images, file_list)
Expand All @@ -135,7 +138,8 @@ def test_WHEN_sub_directory_change_THEN_images_emitted(self, _mock_time):
file_list2 = self._make_simple_dir(self.top_path / "more", t0=2000)
self.assertLess(self.top_path.stat().st_mtime, (self.top_path / 'more').stat().st_mtime)

self.watcher._handle_directory_change(self.top_path / "more")
self.watcher.changed_directory = self.top_path / "more"
self.watcher._handle_directory_change()

emitted_images = self._get_recent_emitted_files()
self._file_list_count_equal(emitted_images, file_list2)

0 comments on commit 109e384

Please sign in to comment.