Optimization #2645
closed
Fix deprecation warnings in tests.
Added by Jason Ish about 6 years ago.
Updated over 5 years ago.
Description
When running tests with Python 3.7 I see some deprecation warnings like:
/home/jason/oisf/code/suricata-update/oisf/tests/test_rule.py:162: DeprecationWarning: invalid escape sequence \;
self.assertEqual(rule.msg, "TEST RULE\; and some")
and
/home/jason/oisf/code/suricata-update/oisf/.tox/py37/lib/python3.7/site-packages/suricata/update/net.py:67: DeprecationWarning: dist() and linux_distribution() functions are deprecated in Python 3.5
distribution = platform.linux_distribution()
Let see if we can fix these in a way that is also compatible with Python 2.7.
You meant legacy python :)?
Do we have a plan how long we want to support 2.7? 2020 will come fast
Pretty long, it depends on the distro's we support.
Shivani and I were just talking about this. Our ultimate goal is to just work with the minimum of dependencies across a majority of distributions. I was thinking we could go Python 3 when, each of:
- oldest supported CentOS
- oldest supported Ubuntu
- oldest supported Debian
all have Python 3 in the enabled by default package repositories. That at least makes it simple to install Python 3.
- Status changed from Assigned to Closed
- Target version set to 1.0.4
Closing this one out. We'll live with the deprecation notice as it gives us more info than if we fixed this. However, Commit 75682f145b3e9f98c8092f2aa8ac06f733fbf3cb futures proofs the code by not crashing if this method does get removed from a future version of Python and this code is still being run as-is.
Also available in: Atom
PDF