python-ivi / python-vxi11

Provides a VXI-11 driver for controlling instruments over Ethernet
MIT License
161 stars 71 forks source link

fix: resolve deprecation warnings #47

Open matt-loft opened 1 year ago

matt-loft commented 1 year ago

The following warnings were output when running the tests:

venv/lib/python3.8/site-packages/nose/importer.py:12
  /home/matt.hanley/github/loft-orbital/python-vxi11/venv/lib/python3.8/site-packages/nose/importer.py:12: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    from imp import find_module, load_module, acquire_lock, release_lock

vxi11/vxi11.py:134
  /home/matt.hanley/github/loft-orbital/python-vxi11/vxi11/vxi11.py:134: DeprecationWarning: invalid escape sequence \d
    m = re.match('^(?P<prefix>(?P<type>TCPIP)\d*)(::(?P<arg1>[^\s:]+))'

vxi11/vxi11.py:135
  /home/matt.hanley/github/loft-orbital/python-vxi11/vxi11/vxi11.py:135: DeprecationWarning: invalid escape sequence \s
    '(::(?P<arg2>[^\s:]+(\[.+\])?))?(::(?P<suffix>INSTR))$',

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

This fixes them by updating the regex string and removing the dependency on nose in favor of simply assert