taurus-org / taurus

Moved to https://gitlab.com/taurus-org/taurus
http://taurus-scada.org
43 stars 46 forks source link

Remove/reduce warnings during tests #1040

Closed cpascual closed 4 years ago

cpascual commented 4 years ago

Pytest captures warnings during tests and shows some worrying warnings. While they seem not to have bad consequences for now, IMHO they should be investigated and corrected if possible before the Jan20 release.

Eventually, we could use the -w flag to turn some or all the warnings into failures, or do some more advanced handling of warnings. See https://docs.pytest.org/en/latest/warnings.html

Here are some examples (for a complete list, look at the "warnings summary" after running tox, as in e.g. here ):


lib/taurus/test/moduleexplorer.py:221

  /home/travis/build/taurus-org/taurus/lib/taurus/test/moduleexplorer.py:221: DeprecationWarning: invalid escape sequence \.

    '_[^\.]*[^_]',

(...)

lib/taurus/core/util/fqdn.py:90

  /home/travis/build/taurus-org/taurus/lib/taurus/core/util/fqdn.py:90: DeprecationWarning: invalid escape sequence \.

    assert re.match(name + "\.[a-zA-Z0-9\.-]+", fqdn_no_alias(name))

(...)

lib/taurus/core/tango/tangovalidator.py:55

  /home/travis/build/taurus-org/taurus/lib/taurus/core/tango/tangovalidator.py:55: DeprecationWarning: invalid escape sequence \w

    authority = '//(?P<host>([\w\-_]+\.)*[\w\-_]+):(?P<port>\d{1,5})'

(...)

  /home/travis/build/taurus-org/taurus/lib/taurus/core/taurusmodel.py:280: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working

    if not isinstance(listeners, collections.Sequence):

lib/taurus/core/resource/test/test_resfactory.py::ResourceFactoryTestCase::test_getAttribute

(...)

lib/taurus/core/tango/test/test_tangoattribute.py::AttributeTestCase::test_write_read_attr_4

  /home/travis/build/taurus-org/taurus/.tox/py37-qt5/lib/python3.7/site-packages/pint/quantity.py:1377: UnitStrippedWarning: The unit of the quantity is stripped.

    warnings.warn("The unit of the quantity is stripped.", UnitStrippedWarning)

(...)

lib/taurus/core/util/test/test_codecs.py::CodecTest::test_encDec

lib/taurus/core/util/test/test_codecs.py::CodecTest::test_encDec_2

  /home/travis/build/taurus-org/taurus/lib/taurus/core/util/codecs.py:702: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead

    img1D = numpy.fromstring(imgBuffer, dtype)

(...)

lib/taurus/qt/qtgui/panel/test/test_taurusform.py::TaurusFormTest::test10_SetModelsSequentially

  /home/travis/build/taurus-org/taurus/.tox/py37-qt5/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject

    return f(*args, **kwds)

(...)

lib/taurus/test/test_import.py::TaurusImportTestCase::testImportSubmodules

  /home/travis/build/taurus-org/taurus/lib/taurus/core/taurusdatabase.py:31: DeprecationWarning: The 'warn' function is deprecated, use 'warning' instead

    warn('taurusdatabase module is deprecated. Use taurusauthority instead')
cpascual commented 4 years ago

fixed by #1114