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

Automatic test fails when calling pyvisa-sim #5

Closed
Arkh42 opened this issue Oct 6, 2020 · 5 comments
Closed

Automatic test fails when calling pyvisa-sim #5

Arkh42 opened this issue Oct 6, 2020 · 5 comments

Comments

@Arkh42
Copy link
Owner

Arkh42 commented Oct 6, 2020

Example:

build (ubuntu-18.04, 3.8)

Run pytest --cov --cov-report=term --cov-report=html
  pytest --cov --cov-report=term --cov-report=html
  shell: /bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.8.5/x64
============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-6.1.1, py-1.9.0, pluggy-0.13.1
rootdir: /home/runner/work/rtestbench/rtestbench, configfile: pytest.ini
plugins: cov-2.10.1
collected 72 items

rtestbench/tests/test_chat.py ......                                     [  8%]
rtestbench/tests/test_core.py ...................EEEEEEE..EEEEEEEEEEEE.F [ 66%]
EFFEEE..                                                                 [ 77%]
rtestbench/tests/test_electrometer.py ..                                 [ 80%]
rtestbench/tests/test_factories.py ..                                    [ 83%]
rtestbench/tests/test_keysight_electrometers.py ..s                      [ 87%]
rtestbench/tests/test_logger.py ...                                      [ 91%]
rtestbench/tests/test_meta.py ......                                     [100%]

============================
            Bye!            
============================



==================================== ERRORS ====================================
________________ ERROR at setup of test_toolFactory_attributes _________________

    @pytest.fixture
    def toolFactory():
        """Returns a ToolFactory object with pyvisa-sim to enable a simulated resource."""
    
>       manager = visa.ResourceManager(visa_library='@sim')

rtestbench/tests/test_core.py:41: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pyvisa/highlevel.py:3015: in __new__
    visa_library = open_visa_library(visa_library)
/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pyvisa/highlevel.py:2929: in open_visa_library
    return cls(argument)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'pyvisa-sim.highlevel.SimVisaLibrary'>, library_path = ''

    def __new__(
        cls: Type[T], library_path: Union[str, LibraryPath] = ""
    ) -> "VisaLibraryBase":
        """Create a new VISA library from the specified path.
    
        If a library was already created using the same path and class this
        library object is returned instead.
    
        Parameters
        ----------
        library_path : str | LibraryPath
            Path to the VISA library to use in the backend.
    
        Raises
        ------
        OSError
            Raised if the VISA library object could not be created.
    
        """
        if library_path == "":
            errs = []
            for path in cls.get_library_paths():
                try:
                    return cls(path)
                except OSError as e:
                    logger.debug("Could not open VISA library %s: %s", path, str(e))
                    errs.append(str(e))
                except Exception as e:
                    errs.append(str(e))
            else:
>               raise OSError("Could not open VISA library:\n" + "\n".join(errs))
E               OSError: Could not open VISA library:

/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/pyvisa/highlevel.py:175: OSError
@Arkh42
Copy link
Owner Author

Arkh42 commented Oct 6, 2020

Found in the documentation of PyVISA on PyPI:

1.11 (16-09-2020)

PyVISA 1.11 introduces a small backward incompatibility in the handling of the arguments to handlers for VISA events.

@Arkh42
Copy link
Owner Author

Arkh42 commented Oct 6, 2020

Issue opened on pyvisa: see issue #553.

@Arkh42
Copy link
Owner Author

Arkh42 commented Oct 13, 2020

Check discussion in pyvisa/pyvisa-sim#53.

@Arkh42
Copy link
Owner Author

Arkh42 commented Oct 14, 2020

Seems to be fixed by https://github.com/pyvisa/pyvisa-sim/tree/drop-py2. Waiting for a proper release of pyvisa-sim to put in the requirements file to close the issue.

@Arkh42
Copy link
Owner Author

Arkh42 commented Oct 15, 2020

Everything works with the release 0.4 of pyvisa-sim!

@Arkh42 Arkh42 closed this as completed Oct 15, 2020
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