Project

General

Profile

Actions

Optimization #2645

closed

Fix deprecation warnings in tests.

Added by Jason Ish over 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Target version:
Effort:
low
Difficulty:
medium
Label:

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.

Actions #1

Updated by Andreas Herz over 5 years ago

You meant legacy python :)?

Do we have a plan how long we want to support 2.7? 2020 will come fast

Actions #2

Updated by Victor Julien over 5 years ago

Pretty long, it depends on the distro's we support.

Actions #3

Updated by Jason Ish over 5 years ago

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.

Actions #4

Updated by Jason Ish about 5 years ago

  • 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.

Actions

Also available in: Atom PDF