Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests incompatible with older mmcore #281

Open
tlambert03 opened this issue Mar 3, 2024 · 0 comments
Open

tests incompatible with older mmcore #281

tlambert03 opened this issue Mar 3, 2024 · 0 comments

Comments

@tlambert03
Copy link
Member

this isn't likely to be something we come across much if ever, but I just ran tests on an older windows setup, without running mmcore install and saw this error:

tests\test_prop_widget.py ..................F
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> captured log >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
DEBUG    pymmcore-plus:_util.py:104 using MM path from user install: C:\Users\talley\AppData\Local\pymmcore-plus\pymmcore-plus\mm\Micro-Manager_2.0.3_20231023       
DEBUG    pymmcore-plus:_mmcore_plus.py:305 setting adapter search paths: ['C:\\Users\\talley\\AppData\\Local\\pymmcore-plus\\pymmcore-plus\\mm\\Micro-Manager_2.0.3_20231023']
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

dev = 'Camera', prop = 'MaximumExposureMs', qtbot = <pytestqt.qtbot.QtBot object at 0x000001715D562080>

    @pytest.mark.parametrize("dev, prop", dev_props)
    def test_property_widget(dev, prop, qtbot):
        wdg = PropertyWidget(dev, prop, mmcore=CORE)
        qtbot.addWidget(wdg)
        if CORE.isPropertyReadOnly(dev, prop) or prop in (
            "SimulateCrash",
            "Trigger",
            "AsyncPropertyLeader",
        ):
            return

        start_val = CORE.getProperty(dev, prop)
        _assert_equal(wdg.value(), start_val)

        # make sure that setting the value via the widget updates core
        if allowed := CORE.getAllowedPropertyValues(dev, prop):
            val = allowed[-1]
        elif CORE.getPropertyType(dev, prop) in (PropertyType.Integer, PropertyType.Float):
            # these are just numbers that work for the test config devices
            _vals = {
                "TestProperty": 1,
                "Photon Flux": 50,
                "TestProperty1": 0.01,
                "TestProperty3": 0.002,
                "OnCameraCCDXSize": 20,
                "OnCameraCCDYSize": 20,
                "FractionOfPixelsToDropOrSaturate": 0.05,
            }
            val = _vals.get(prop, 1)
        else:
            val = "some string"

        before = wdg.value()
        wdg.setValue(val)

        strict_init = hasattr(CORE, "isFeatureEnabled") and CORE.isFeatureEnabled(
            "StrictInitializationChecks"
        )
        if CORE.isPropertyPreInit(dev, prop) and strict_init:
            # as of pymmcore 10.7.0.71.0, setting pre-init properties
            # after the device has been initialized does nothing.
            _assert_equal(wdg.value(), before)
            return

>       _assert_equal(wdg.value(), val)

tests\test_prop_widget.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _  

a = 10000.0, b = 1

    def _assert_equal(a, b):
        try:
>           assert float(a) == float(b)
E           assert 10000.0 == 1.0
E            +  where 10000.0 = float(10000.0)
E            +  and   1.0 = float(1)

tests\test_prop_widget.py:25: AssertionError

I believe it might be an MMCore incompatibility (Micro-Manager_2.0.3_20231023) ... but will look into it later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant