diff --git a/qcodes/tests/common.py b/qcodes/tests/common.py index b39a98e8e24..adb35214738 100644 --- a/qcodes/tests/common.py +++ b/qcodes/tests/common.py @@ -3,6 +3,7 @@ from time import sleep import cProfile +from qcodes.utils.metadata import Metadatable if TYPE_CHECKING: from _pytest._code.code import ExceptionInfo @@ -118,3 +119,18 @@ def error_caused_by(excinfo: 'ExceptionInfo', cause: str) -> bool: return cause in str(root_traceback) +class DumyPar(Metadatable): + + """Docstring for DumyPar. """ + + def __init__(self, name): + super().__init__() + self.name = name + self.full_name = name + + def __str__(self): + return self.full_name + + def set(self, value): + value = value * 2 + return value diff --git a/qcodes/tests/parameter/test_combined_par.py b/qcodes/tests/parameter/test_combined_par.py index 005e3f34b7e..818ae7bddb3 100644 --- a/qcodes/tests/parameter/test_combined_par.py +++ b/qcodes/tests/parameter/test_combined_par.py @@ -10,25 +10,9 @@ import numpy as np from qcodes.instrument.parameter import combine -from qcodes.utils.metadata import Metadatable -from qcodes.utils.helpers import full_class - - -class DumyPar(Metadatable): - - """Docstring for DumyPar. """ - def __init__(self, name): - super().__init__() - self.name = name - self.full_name = name - - def __str__(self): - return self.full_name - - def set(self, value): - value = value * 2 - return value +from qcodes.utils.helpers import full_class +from ..common import DumyPar class TestMultiPar(unittest.TestCase): diff --git a/qcodes/tests/parameter/test_delegate_parameter.py b/qcodes/tests/parameter/test_delegate_parameter.py index eeaa8736c98..38e738d3198 100644 --- a/qcodes/tests/parameter/test_delegate_parameter.py +++ b/qcodes/tests/parameter/test_delegate_parameter.py @@ -13,6 +13,7 @@ # Disable warning that is created by using fixtures # pylint: disable=redefined-outer-name + @pytest.fixture() def numeric_val(): yield 1 diff --git a/qcodes/tests/test_station.py b/qcodes/tests/test_station.py index a2cc8b5248d..c966df1563d 100644 --- a/qcodes/tests/test_station.py +++ b/qcodes/tests/test_station.py @@ -21,10 +21,10 @@ from qcodes.monitor.monitor import Monitor from qcodes.tests.instrument_mocks import ( DummyInstrument) -from qcodes.tests.test_combined_par import DumyPar from qcodes.tests.test_config import default_config from qcodes.utils.helpers import NumpyJSONEncoder from qcodes.utils.helpers import YAML +from .common import DumyPar @pytest.fixture(autouse=True)