Skip to content

Commit

Permalink
Fix wild import warnings in system tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robertapplin committed Oct 18, 2024
1 parent 89f0648 commit 13dd6dd
Show file tree
Hide file tree
Showing 156 changed files with 1,054 additions and 270 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@
PythonAlgorithm,
)
from mantid.dataobjects import TableWorkspace
from mantid.kernel import logger, FloatArrayProperty, IntArrayProperty
from mantid.kernel import Direction, FloatArrayProperty, FloatBoundedValidator, IntArrayProperty, IntListValidator, StringListValidator
from mantid.simpleapi import CloneWorkspace, Fit, LoadVesuvio, MaskDetectors, Minus, Rebin, RenameWorkspace, Scale, SumSpectra
from mantid.kernel import StringListValidator, IntListValidator, FloatBoundedValidator, Direction
from Inelastic.vesuvio.analysisHelpers import (
block_fit_ncp,
final_fit,
Expand All @@ -50,6 +49,7 @@
create_slab_geometry,
generate_elements,
generate_constraints,
logger,
prepare_fit_arguments,
subtract_other_masses,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,invalid-name,too-many-locals,too-many-branches
from mantid.api import AlgorithmFactory, AlgorithmManager, IEventWorkspace, MatrixWorkspaceProperty, Progress, PythonAlgorithm
from mantid.kernel import CommonBinsValidator, Direction, IntArrayBoundedValidator, IntArrayProperty, Logger
from mantid.api import (
AlgorithmFactory,
AlgorithmManager,
CommonBinsValidator,
IEventWorkspace,
MatrixWorkspaceProperty,
Progress,
PythonAlgorithm,
)
from mantid.kernel import Direction, IntArrayBoundedValidator, IntArrayProperty, Logger
import numpy as np


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

import scipy.constants

from mantid.api import AlgorithmFactory, Progress, PythonAlgorithm, WorkspaceProperty
from mantid.kernel import logger, Direction, FileAction, FileProperty, StringArrayProperty, StringListValidator
from mantid.api import AlgorithmFactory, FileAction, FileProperty, Progress, PythonAlgorithm, WorkspaceProperty
from mantid.kernel import logger, Direction, StringArrayProperty, StringListValidator
import mantid.simpleapi as s_api


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
IntArrayMandatoryValidator,
IntArrayProperty,
Property,
SofQWMoments,
StringArrayProperty,
StringListValidator,
Rebin,
)
from mantid.simpleapi import Fit, LoadLog
from mantid.simpleapi import Fit, LoadLog, Rebin, SofQWMoments

import os
import numpy as np
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@
from mantid.api import mtd, AlgorithmFactory, Progress, PropertyMode, PythonAlgorithm, WorkspaceGroupProperty, WorkspaceProperty
from mantid.kernel import (
logger,
Direction,
FloatArrayProperty,
IntArrayProperty,
StringArrayProperty,
)
from mantid.simpleapi import (
CalculateFlatBackground,
CropWorkspace,
DeleteWorkspace,
Direction,
Divide,
GroupWorkspaces,
Integration,
FloatArrayProperty,
IntArrayProperty,
StringArrayProperty,
Load,
Transpose,
)
from mantid.simpleapi import Load

from IndirectCommon import check_hist_zero

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
# SPDX - License - Identifier: GPL - 3.0 +
import unittest

from mantid.kernel import *
from mantid.api import *
from mantid.simpleapi import *
from mantid.api import AnalysisDataService, MatrixWorkspace
from mantid.simpleapi import CreateWorkspace, DeleteWorkspace, GroupWorkspaces, PoldiMerge

import numpy as np

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
import unittest
from mantid.api import AlgorithmManager
from mantid.api import AlgorithmManager, FrameworkManager
import numpy as np
from SANSFitShiftScale import ErrorTransferFromModelToData

Expand Down Expand Up @@ -293,4 +293,5 @@ def test_that_error_is_transferred(self):


if __name__ == "__main__":
FrameworkManager.Instance()
unittest.main()
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
import unittest
from mantid.api import AlgorithmManager, MatrixWorkspace
from mantid.api import AlgorithmManager, FrameworkManager, MatrixWorkspace
import numpy as np

from SANSStitch import QErrorCorrectionForMergedWorkspaces
Expand Down Expand Up @@ -890,4 +890,5 @@ def test_correct_x_error_is_produced(self):


if __name__ == "__main__":
FrameworkManager.Instance()
unittest.main()
4 changes: 3 additions & 1 deletion Testing/SystemTests/tests/framework/ARCSReductionTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

import os
import systemtesting
from mantid.simpleapi import *
from mantid.api import mtd
from mantid.kernel import config
from mantid.simpleapi import DeleteWorkspace, DgsReduction, ExtractMask, Load, LoadNXSPE, SaveNXSPE


class ARCSReductionTest(systemtesting.MantidSystemTest):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,27 @@
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,invalid-name,attribute-defined-outside-init
import systemtesting
from mantid.simpleapi import *
from mantid.api import WorkspaceFactory
from mantid.api import mtd, AnalysisDataService, WorkspaceFactory
from mantid.kernel import PropertyManagerDataService
from mantid.simpleapi import (
AlignAndFocusPowder,
AlignAndFocusPowderFromFiles,
ConvertUnits,
CreateGroupingWorkspace,
CylinderAbsorption,
DeleteWorkspace,
Divide,
FilterBadPulses,
LoadDiffCal,
LoadEventAndCompress,
LoadEventNexus,
NormaliseByCurrent,
PDDetermineCharacterizations,
PDLoadCharacterizations,
RebinRagged,
SetSample,
SortEvents,
)
import numpy as np
import os
import time
Expand Down Expand Up @@ -418,7 +437,7 @@ def runTest(self):
for i in range(absorptionWS.getNumberHistograms()):
absorptionWS.setX(i, xaxis)
absorptionWS.getAxis(0).setUnit("Wavelength")
mantid.api.AnalysisDataService.addOrReplace("V_abs", absorptionWS)
AnalysisDataService.addOrReplace("V_abs", absorptionWS)
SetSample(
InputWorkspace="V_abs",
Material={"ChemicalFormula": "V", "SampleNumberDensity": 0.0721},
Expand Down
16 changes: 14 additions & 2 deletions Testing/SystemTests/tests/framework/BuildSQWTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,19 @@

import systemtesting
import os
from mantid.simpleapi import *
from mantid.kernel import config, logger
from mantid.simpleapi import (
CompareMDWorkspaces,
ConvertToMD,
DeleteWorkspace,
LoadMD,
LoadNXSPE,
LoadSQW,
MergeMDFiles,
SaveMD,
SetGoniometer,
SetUB,
)

# allow for multiple locations
FILE_LOCATIONS = ["/isis/mantid/localtestdata/"] # ,"d:/Data/MantidSystemTests/BigData/Dropbox/LoadSQW"]
Expand Down Expand Up @@ -109,7 +121,7 @@ def cleanup(self):
try:
os.remove(filename)
except OSError:
mantid.logger.warning("Unable to remove created file '%s'" % filename)
logger.warning("Unable to remove created file '%s'" % filename)


class LoadSQW_FileBasedTest(BuildSQWTest):
Expand Down
4 changes: 3 additions & 1 deletion Testing/SystemTests/tests/framework/CNCSReductionTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

import os
import systemtesting
from mantid.simpleapi import *
from mantid.api import mtd
from mantid.kernel import config
from mantid.simpleapi import CNCSSuggestTIB, DeleteWorkspace, DgsReduction, GenerateGroupingPowder, Load, LoadNXSPE, SaveNXSPE


class CNCSReductionTest(systemtesting.MantidSystemTest):
Expand Down
2 changes: 1 addition & 1 deletion Testing/SystemTests/tests/framework/CRISPLoadingTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from LoadAndCheckBase import *
from LoadAndCheckBase import LoadAndCheckBase


class CRISPLoadingTest(LoadAndCheckBase):
Expand Down
2 changes: 1 addition & 1 deletion Testing/SystemTests/tests/framework/CalMuonDeadTimeTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,attribute-defined-outside-init
import systemtesting
from mantid.simpleapi import *
from mantid.simpleapi import CalMuonDeadTime, GroupWorkspaces, Load


class CalMuonDeadTimeTest(systemtesting.MantidSystemTest):
Expand Down
2 changes: 1 addition & 1 deletion Testing/SystemTests/tests/framework/CodeConventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import systemtesting
import re
import mantid
from mantid.simpleapi import *
from mantid.api import AlgorithmFactory

MAX_ALG_LEN = 40 # TODO convention says 20 is the maximum

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"""

import systemtesting
from mantid.simpleapi import *
from mantid.api import mtd
from mantid.simpleapi import ChangeBinOffset, CompareMDWorkspaces, ConvertToMD, CreateSampleWorkspace, MergeMD


class CompareMDWorkspacesTest(systemtesting.MantidSystemTest):
Expand Down
3 changes: 2 additions & 1 deletion Testing/SystemTests/tests/framework/CompressEvents.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,invalid-name,attribute-defined-outside-init
import systemtesting
from mantid.simpleapi import *
from mantid.api import mtd
from mantid.simpleapi import CompressEvents, Integration, LoadEventNexus, SumSpectra


class CompressEventsTesting(systemtesting.MantidSystemTest):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
# pylint: disable=no-init
import sys
import systemtesting
from mantid.simpleapi import *
from mantid.api import mtd
from mantid.simpleapi import BinMD, CompareMDWorkspaces, ConvertToMD, CreateSampleWorkspace


class ConvToMDCompareDefaultVsIndexing(systemtesting.MantidSystemTest):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import platform
import systemtesting
import numpy as np
from mantid.simpleapi import *
from mantid.api import AlgorithmManager
from mantid.simpleapi import ConvertHFIRSCDtoMDE, FindPeaksMD, HFIRCalculateGoniometer, IndexPeaks, Load, LoadMD, SaveMD, SetGoniometer


def _skip_test():
Expand Down
3 changes: 2 additions & 1 deletion Testing/SystemTests/tests/framework/ConvertToMDworkflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init
import systemtesting
from mantid.simpleapi import *
from mantid.api import AlgorithmManager
from mantid.simpleapi import AddSampleLog, CloneWorkspace, ConvertToMD, DeleteWorkspace, Load, SaveMD, SetGoniometer, SetUB


# ----------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion Testing/SystemTests/tests/framework/ConvertWANDSCDtoQTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# SPDX - License - Identifier: GPL - 3.0 +
import systemtesting
import numpy as np
from mantid.simpleapi import *
from mantid.api import AlgorithmManager
from mantid.simpleapi import ConvertWANDSCDtoQ, FindPeaksMD, IndexPeaks, Load, LoadMD, SaveMD, SetGoniometer, SetUB


class ConvertWANDSCDtoQTest(systemtesting.MantidSystemTest):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
import systemtesting
from mantid.simpleapi import *
from mantid.simpleapi import CountReflections
from SortHKLTest import HKLStatisticsTestMixin


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
import systemtesting
from mantid.simpleapi import *
from mantid.api import mtd
from mantid.kernel import config
from mantid.simpleapi import AppendSpectra, D7AbsoluteCrossSections, PolDiffILLReduction, RenameWorkspace
import numpy as np


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
import systemtesting
from mantid.simpleapi import *
from mantid.api import ITableWorkspace
from mantid.api import mtd, ITableWorkspace
from mantid.kernel import config, ConfigService
from mantid.simpleapi import CloneWorkspace, D7YIGPositionCalibration, DeleteWorkspace, Load, LoadILLPolarizedDiffraction

import math
import os.path
Expand Down
4 changes: 1 addition & 3 deletions Testing/SystemTests/tests/framework/DOSTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=no-init,attribute-defined-outside-init
import systemtesting
from mantid.kernel import *
from mantid.api import *
from mantid.simpleapi import *
from mantid.simpleapi import SimulatedDensityOfStates

# ------------------------------------------------------------------------------------

Expand Down
17 changes: 16 additions & 1 deletion Testing/SystemTests/tests/framework/Diffraction_Workflow_Test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,22 @@
import systemtesting
import numpy
import os
from mantid.simpleapi import *
from mantid.api import mtd
from mantid.simpleapi import (
AnvredCorrection,
BinMD,
CentroidPeaksMD,
CopySample,
ConvertToDiffractionMDWorkspace,
FindPeaksMD,
FindUBUsingFFT,
FindUBUsingLatticeParameters,
IndexPeaks,
IntegratePeaksMD,
LoadEventNexus,
LoadHKL,
SaveHKL,
)
from mantid.api import FileFinder


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
import systemtesting
from mantid.simpleapi import *
from mantid.api import mtd
from mantid.kernel import config
from mantid.simpleapi import DirectILLAutoProcess, GroupWorkspaces, Load


class DirectILLAuto_PANTHER_Powder_Test(systemtesting.MantidSystemTest):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
# pylint: disable=invalid-name,no-init
import os
from systemtesting import MantidSystemTest
from mantid.simpleapi import *
from mantid.api import mtd
from mantid.simpleapi import pmds, DgsDiagnose, Load, MaskDetectors
from mantid.kernel import PropertyManager
from mantid import config

Expand Down
Loading

0 comments on commit 13dd6dd

Please sign in to comment.