nimi-python icon indicating copy to clipboard operation
nimi-python copied to clipboard

niswitch system tests that use session-simulated DAQmx devices fail intermittently and hence disabled

Open sbethur opened this issue 3 years ago • 2 comments

Description of issue

Tests in question: https://github.com/ni/nimi-python/blob/065267a827bb0c8256a5122d33be28f8987a0265/src/niswitch/system_tests/test_system_niswitch.py#L64 https://github.com/ni/nimi-python/blob/065267a827bb0c8256a5122d33be28f8987a0265/src/niswitch/system_tests/test_system_niswitch.py#L110

The error log:

=================================== ERRORS ====================================
_____________ ERROR at setup of test_continuous_software_scanning _____________

    @pytest.fixture(scope='function')
    def session_2532():
        with daqmx_sim_db_lock:
>           simulated_session = niswitch.Session('', '2532/1-Wire 4x128 Matrix', True, False)

..\..\src\niswitch\system_tests\test_system_niswitch.py:32: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
niswitch\session.py:1562: in __init__
    self._vi = self._init_with_topology(resource_name, topology, simulate, reset_device)
niswitch\session.py:2274: in _init_with_topology
    errors.handle_error(self, error_code, ignore_warnings=False, is_error_handling=False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

session = niswitch.Session(repeated_capability_list=[], vi=None, library=None, encoding=None)
code = -1074135030, ignore_warnings = False, is_error_handling = False

    def handle_error(session, code, ignore_warnings, is_error_handling):
        '''handle_error
    
        Helper function for handling errors returned by niswitch.Library.
        It calls back into the session to get the corresponding error description
        and raises if necessary.
        '''
    
        if _is_success(code) or (_is_warning(code) and ignore_warnings):
            return
    
        if is_error_handling:
            # The caller is in the midst of error handling and an error occurred.
            # Don't try to get the description or we'll start recursing until the stack overflows.
            description = ''
        else:
            description = session._get_error_description(code)
    
        if _is_error(code):
>           raise DriverError(code, description)
E           niswitch.errors.DriverError: -1074135030: IVI: (Hex 0xBFFA000A) Failure loading driver module.
E           
E           The driver for the DAQmx switch is not loaded

niswitch\errors.py:102: DriverError

System report

python -c 'import niswitch; niswitch.print_diagnostic_information()'
OS:
   Name:      Windows
   Version:   10.0.19041
   Bits:      64
Driver:
   Name:      NI-SWITCH
   Version:   20.5.0.49152
Module:
   Name:      niswitch
   Version:   1.3.4.dev0
Python:
   Version:   3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)]
   Bits:      64
   Is_Venv:   True
   Installed Packages:
       niswitch==1.3.4.dev0
       zipp==3.4.1
       wheel==0.33.6
       typing-extensions==3.10.0.0
       toml==0.10.2
       six==1.16.0
       setuptools==42.0.2
       scipy==1.5.4
       pytest==6.2.4
       pytest-json==0.4.0
       pyparsing==2.4.7
       py==1.10.0
       pluggy==0.13.1
       pip==21.1.2
       packaging==20.9
       numpy==1.19.5
       iniconfig==1.1.1
       importlib-metadata==4.3.0
       hightime==0.2.0
       fasteners==0.16
       coverage==5.5
       colorama==0.4.4
       attrs==21.2.0
       atomicwrites==1.4.0

These tests had been problematic earlier too - #268, #276.

sbethur avatar Jun 03 '21 17:06 sbethur

Filed an internal bug - #1498558 for the underlying issue.

sbethur avatar Jun 14 '21 17:06 sbethur

For other drivers, we create persistent simulated devices in nimi-bot. Those are painful because we need to synchronize access to them but it would at least allow us to get this test coverage back in a reliable manner.

marcoskirsch avatar Dec 15 '22 23:12 marcoskirsch