Skip to content

Commit

Permalink
Merge pull request #970 from mantidproject/update_ads_clear_with_flag
Browse files Browse the repository at this point in the history
Update tests with True flag for ADS.clear()
  • Loading branch information
SilkeSchomann committed Feb 15, 2024
2 parents 2a7324b + b30fee6 commit bb0de1f
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 32 deletions.
5 changes: 1 addition & 4 deletions tests/cut_algorithm_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import numpy as np
from unittest import TestCase
from unittest.mock import MagicMock, patch
import warnings

from mantid.api import AnalysisDataService
from mantid.dataobjects import MDHistoWorkspace
Expand All @@ -28,9 +27,7 @@ def setUp(self):
self.theta_axis = Axis("2Theta", -10, 15, 1)

def tearDown(self) -> None:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
AnalysisDataService.clear()
AnalysisDataService.clear(True)

def xtest_that_compute_cut_returns_a_result_with_the_expected_size_for_normalized_psd_rebin_data(self):
normalized = True
Expand Down
5 changes: 1 addition & 4 deletions tests/cut_functions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from mock import patch
from unittest import TestCase
import warnings

from mantid.api import AlgorithmFactory, AnalysisDataService
from mantid.simpleapi import AddSampleLog, _create_algorithm_function
Expand Down Expand Up @@ -42,9 +41,7 @@ def setUpClass(cls):

@classmethod
def tearDownClass(cls) -> None:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
AnalysisDataService.clear()
AnalysisDataService.clear(True)

def test_that_output_workspace_name_returns_the_expected_result(self):
self.assertEqual(output_workspace_name(self.workspace_name, self.integration_start, self.integration_end),
Expand Down
5 changes: 1 addition & 4 deletions tests/cut_normalisation_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numpy as np
from unittest import TestCase
import warnings

from mantid.api import AnalysisDataService

Expand All @@ -15,9 +14,7 @@ def setUp(self):
self.md_histo_ws = create_md_histo_workspace(2, "md_histo_ws")

def tearDown(self) -> None:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
AnalysisDataService.clear()
AnalysisDataService.clear(True)

def test_that_normalize_workspace_fails_for_a_non_IMDHistoWorkspace(self):
try:
Expand Down
5 changes: 1 addition & 4 deletions tests/projection_calculator_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from unittest import TestCase
import warnings

from mantid.api import AnalysisDataService

Expand All @@ -21,9 +20,7 @@ def setUp(self):
self.projection_calculator = MantidProjectionCalculator()

def tearDown(self) -> None:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
AnalysisDataService.clear()
AnalysisDataService.clear(True)

def test_available_axes(self):
self.assertEqual(self.projection_calculator.available_axes(), ['|Q|', '2Theta', 'DeltaE'])
Expand Down
5 changes: 1 addition & 4 deletions tests/rebose_algorithm_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import unittest
import warnings

from mantid.api import AnalysisDataService
from tests.testhelpers.workspace_creator import create_workspace
Expand All @@ -14,9 +13,7 @@ def setUpClass(cls):

@classmethod
def tearDownClass(cls) -> None:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
AnalysisDataService.clear()
AnalysisDataService.clear(True)

def test_rebose_algorithm(self):
results = Rebose(self.test_workspace)
Expand Down
5 changes: 1 addition & 4 deletions tests/slice_algorithm_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from mock import patch, MagicMock, call, ANY
import numpy as np
import unittest
import warnings

from mantid.simpleapi import AddSampleLog, AnalysisDataService
from mantid.kernel import PropertyManager
Expand Down Expand Up @@ -56,9 +55,7 @@ def setUpClass(cls):

def tearDown(self) -> None:
self.test_objects = None # reset test objects
with warnings.catch_warnings():
warnings.simplefilter("ignore")
AnalysisDataService.clear()
AnalysisDataService.clear(True)

@staticmethod
def _create_tst_objects(sim_scattering_data, x_dict, y_dict, norm_to_one=False, PSD=False, e_mode='Direct'):
Expand Down
5 changes: 1 addition & 4 deletions tests/slice_functions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from mock import patch, MagicMock
import numpy as np
import unittest
import warnings

from mantid.api import AlgorithmFactory
from mantid.simpleapi import AddSampleLog, _create_algorithm_function, AnalysisDataService
Expand Down Expand Up @@ -35,9 +34,7 @@ def setUpClass(cls):

@classmethod
def tearDownClass(cls) -> None:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
AnalysisDataService.clear()
AnalysisDataService.clear(True)

@patch('mslice.models.slice.slice_functions.mantid_algorithms')
def test_slice(self, alg_mock):
Expand Down
5 changes: 1 addition & 4 deletions tests/workspace_algorithms_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import (absolute_import, division, print_function)

import unittest
import warnings

from mslice.models.axis import Axis
from mslice.models.workspacemanager.workspace_algorithms import (process_limits, process_limits_event, scale_workspaces,
Expand Down Expand Up @@ -45,9 +44,7 @@ def setUpClass(cls):

@classmethod
def tearDownClass(cls) -> None:
with warnings.catch_warnings():
warnings.simplefilter("ignore")
AnalysisDataService.clear()
AnalysisDataService.clear(True)

def test_process_limits_does_not_fail_for_direct_data(self):
process_limits(self.direct_workspace)
Expand Down

0 comments on commit bb0de1f

Please sign in to comment.