GithubHelp home page GithubHelp logo

arkh42 / rtestbench Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 3.0 181 KB

Toolkit written in Python that allows the user to create a software remote test bench to control an actual electronic test bench remotely.

Home Page: https://rtestbench.readthedocs.io/en/latest/

License: Open Software License 3.0

Python 100.00%
python python3 electronics instrument instruments instrumentation instrumentation-tests control remote-control remote-sensing

rtestbench's People

Contributors

arkh42 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

rtestbench's Issues

Cannot log in RTestBench destructor

It seems to have a conflict due to the visa package.
When the destructor of RTestBench is called, visa has probably already performed

logging.shutdown()

which then makes no longer possible to log anything.

Found possibly related issues and pull requests:

Automatic test fails on Python 3.5

Log :

 Run pytest
============================= test session starts ==============================
platform linux -- Python 3.5.9, pytest-5.4.2, py-1.8.1, pluggy-0.13.1
rootdir: /home/runner/work/rtestbench/rtestbench
collected 71 items

rtestbench/tests/test_chat.py ...                                        [  4%]
rtestbench/tests/test_core.py ..........                                 [ 18%]
rtestbench/tests/test_electrometer.py ..........                         [ 32%]
rtestbench/tests/test_factories.py ...........                           [ 47%]
rtestbench/tests/test_keysight_electrometers.py .................        [ 71%]
rtestbench/tests/test_logger.py ..                                       [ 74%]
rtestbench/tests/test_meta.py E.EEEE                                     [ 83%]
rtestbench/tests/test_tool.py ............                               [100%]

==================================== ERRORS ====================================
______________________ ERROR at setup of test_initialize _______________________

tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_initialize0')

    @pytest.fixture
    def meta_man(tmp_path):
        """Returns a MetaDataManager."""
    
        d = tmp_path / "json"
        d.mkdir()
    
        f = d / "meta_file"
>       man = meta.MetaDataManager(f)

rtestbench/tests/test_meta.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
rtestbench/_meta.py:27: in __init__
    self._file_path = Path(file_path)
/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/pathlib.py:969: in __new__
    self = cls._from_parts(args, init=False)
/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/pathlib.py:651: in _from_parts
    drv, root, parts = self._parse_args(args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'pathlib.PosixPath'>
args = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_initialize0/json/meta_file'),)

    @classmethod
    def _parse_args(cls, args):
        # This is useful when you don't want to create an instance, just
        # canonicalize some constructor arguments.
        parts = []
        for a in args:
            if isinstance(a, PurePath):
                parts += a._parts
            elif isinstance(a, str):
                # Force-cast str subclasses to str (issue #21127)
                parts.append(str(a))
            else:
                raise TypeError(
                    "argument should be a path or str object, not %r"
>                   % type(a))
E               TypeError: argument should be a path or str object, not <class 'pathlib2.PosixPath'>

/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/pathlib.py:643: TypeError
_________________ ERROR at setup of test_dump_meta[json_data0] _________________

tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_dump_meta_json_data0_0')

    @pytest.fixture
    def meta_man(tmp_path):
        """Returns a MetaDataManager."""
    
        d = tmp_path / "json"
        d.mkdir()
    
        f = d / "meta_file"
>       man = meta.MetaDataManager(f)

rtestbench/tests/test_meta.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
rtestbench/_meta.py:27: in __init__
    self._file_path = Path(file_path)
/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/pathlib.py:969: in __new__
    self = cls._from_parts(args, init=False)
/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/pathlib.py:651: in _from_parts
    drv, root, parts = self._parse_args(args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'pathlib.PosixPath'>
args = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_dump_meta_json_data0_0/json/meta_file'),)

    @classmethod
    def _parse_args(cls, args):
        # This is useful when you don't want to create an instance, just
        # canonicalize some constructor arguments.
        parts = []
        for a in args:
            if isinstance(a, PurePath):
                parts += a._parts
            elif isinstance(a, str):
                # Force-cast str subclasses to str (issue #21127)
                parts.append(str(a))
            else:
                raise TypeError(
                    "argument should be a path or str object, not %r"
>                   % type(a))
E               TypeError: argument should be a path or str object, not <class 'pathlib2.PosixPath'>

/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/pathlib.py:643: TypeError
_________________ ERROR at setup of test_dump_meta[json_data1] _________________

tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_dump_meta_json_data1_0')

    @pytest.fixture
    def meta_man(tmp_path):
        """Returns a MetaDataManager."""
    
        d = tmp_path / "json"
        d.mkdir()
    
        f = d / "meta_file"
>       man = meta.MetaDataManager(f)

rtestbench/tests/test_meta.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
rtestbench/_meta.py:27: in __init__
    self._file_path = Path(file_path)
/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/pathlib.py:969: in __new__
    self = cls._from_parts(args, init=False)
/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/pathlib.py:651: in _from_parts
    drv, root, parts = self._parse_args(args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'pathlib.PosixPath'>
args = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_dump_meta_json_data1_0/json/meta_file'),)

    @classmethod
    def _parse_args(cls, args):
        # This is useful when you don't want to create an instance, just
        # canonicalize some constructor arguments.
        parts = []
        for a in args:
            if isinstance(a, PurePath):
                parts += a._parts
            elif isinstance(a, str):
                # Force-cast str subclasses to str (issue #21127)
                parts.append(str(a))
            else:
                raise TypeError(
                    "argument should be a path or str object, not %r"
>                   % type(a))
E               TypeError: argument should be a path or str object, not <class 'pathlib2.PosixPath'>

/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/pathlib.py:643: TypeError
____________________ ERROR at setup of test_dump_timestamp _____________________

tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_dump_timestamp0')

    @pytest.fixture
    def meta_man(tmp_path):
        """Returns a MetaDataManager."""
    
        d = tmp_path / "json"
        d.mkdir()
    
        f = d / "meta_file"
>       man = meta.MetaDataManager(f)

rtestbench/tests/test_meta.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
rtestbench/_meta.py:27: in __init__
    self._file_path = Path(file_path)
/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/pathlib.py:969: in __new__
    self = cls._from_parts(args, init=False)
/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/pathlib.py:651: in _from_parts
    drv, root, parts = self._parse_args(args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'pathlib.PosixPath'>
args = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_dump_timestamp0/json/meta_file'),)

    @classmethod
    def _parse_args(cls, args):
        # This is useful when you don't want to create an instance, just
        # canonicalize some constructor arguments.
        parts = []
        for a in args:
            if isinstance(a, PurePath):
                parts += a._parts
            elif isinstance(a, str):
                # Force-cast str subclasses to str (issue #21127)
                parts.append(str(a))
            else:
                raise TypeError(
                    "argument should be a path or str object, not %r"
>                   % type(a))
E               TypeError: argument should be a path or str object, not <class 'pathlib2.PosixPath'>

/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/pathlib.py:643: TypeError
_____________________ ERROR at setup of test_dump_run_info _____________________

tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_dump_run_info0')

    @pytest.fixture
    def meta_man(tmp_path):
        """Returns a MetaDataManager."""
    
        d = tmp_path / "json"
        d.mkdir()
    
        f = d / "meta_file"
>       man = meta.MetaDataManager(f)

rtestbench/tests/test_meta.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
rtestbench/_meta.py:27: in __init__
    self._file_path = Path(file_path)
/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/pathlib.py:969: in __new__
    self = cls._from_parts(args, init=False)
/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/pathlib.py:651: in _from_parts
    drv, root, parts = self._parse_args(args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'pathlib.PosixPath'>
args = (PosixPath('/tmp/pytest-of-runner/pytest-0/test_dump_run_info0/json/meta_file'),)

    @classmethod
    def _parse_args(cls, args):
        # This is useful when you don't want to create an instance, just
        # canonicalize some constructor arguments.
        parts = []
        for a in args:
            if isinstance(a, PurePath):
                parts += a._parts
            elif isinstance(a, str):
                # Force-cast str subclasses to str (issue #21127)
                parts.append(str(a))
            else:
                raise TypeError(
                    "argument should be a path or str object, not %r"
>                   % type(a))
E               TypeError: argument should be a path or str object, not <class 'pathlib2.PosixPath'>

/opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/pathlib.py:643: TypeError
=============================== warnings summary ===============================
rtestbench/tests/test_tool.py::ToolTest::test_query_data
  /opt/hostedtoolcache/Python/3.5.9/x64/lib/python3.5/site-packages/pyvisa/util.py:210: DeprecationWarning: string or file could not be read to its end due to unmatched data; this will raise a ValueError in the future.
    sep=separator)

-- Docs: https://docs.pytest.org/en/latest/warnings.html
=========================== short test summary info ============================
ERROR rtestbench/tests/test_meta.py::test_initialize - TypeError: argument sh...
ERROR rtestbench/tests/test_meta.py::test_dump_meta[json_data0] - TypeError: ...
ERROR rtestbench/tests/test_meta.py::test_dump_meta[json_data1] - TypeError: ...
ERROR rtestbench/tests/test_meta.py::test_dump_timestamp - TypeError: argumen...
ERROR rtestbench/tests/test_meta.py::test_dump_run_info - TypeError: argument...
=================== 66 passed, 1 warning, 5 errors in 2.00s ====================
##[error]Process completed with exit code 1.

'Install dependencies' step fails on Windows automatic test

Log :

Run python -m pip install --upgrade pip
  python -m pip install --upgrade pip
  pip install flake8 pytest
  if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
  env:
    pythonLocation: C:\hostedtoolcache\windows\Python\3.5.4\x64
##[error]Process completed with exit code 1.

'Lint with flake8' step fails on Ubunto automatic test

Log :

Run # stop the build if there are Python syntax errors or undefined names
  # stop the build if there are Python syntax errors or undefined names
  flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
  # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
  flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
  shell: /bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.5.9/x64
./setup.py:20:10: E999 SyntaxError: invalid syntax
    author="Alexandre Quenon",
         ^
./rtestbench/core.py:75:34: F821 undefined name 'error_msg'
            self.logger.critical(error_msg)
                                 ^
./rtestbench/tools/tool.py:218:20: F632 use ==/!= to compare constant literals (str, bytes, int, float, tuple)
                if self.transfer_format is 'text':
                   ^
./rtestbench/tools/tool.py:223:22: F632 use ==/!= to compare constant literals (str, bytes, int, float, tuple)
                elif self.transfer_format is 'bin64':
                     ^
./rtestbench/tools/keysight/electrometer/b2985a.py:112:25: F821 undefined name 'condition'
                        condition, self.id, self._available_output_low_states))
                        ^
./rtestbench/tools/keysight/electrometer/b2985a.py:116:108: F821 undefined name 'condition'
            self.logger.info("The system {} output source's low state has been set to {}.".format(self.id, condition))
                                                                                                           ^
./rtestbench/post_processing/frequency.py:48:17: F821 undefined name 'y_data'

Automatic test fails when calling pyvisa-sim

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

set source voltage output

Not an issue. But, a rtestbench newbie question.....
I have installed rtestbench & it is working with my B2987A.
I looked through the repo & can not figure out how to set the source voltage output.
I was wanting to set the source voltage output to 600V turn on the source voltage & then take a temp reading.
It should be pretty simple, though I'm having a ton of trouble setting the source voltage & turning it on......
Thanks & Best Regards
BK

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.