Project

General

Profile

Actions

Optimization #2645

closed
JI SB

Fix deprecation warnings in tests.

Optimization #2645: Fix deprecation warnings in tests.

Added by Jason Ish over 7 years ago. Updated about 7 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.

AH Updated by Andreas Herz over 7 years ago Actions #1

You meant legacy python :)?

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

VJ Updated by Victor Julien over 7 years ago Actions #2

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

JI Updated by Jason Ish over 7 years ago Actions #3

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.

JI Updated by Jason Ish about 7 years ago Actions #4

  • 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: PDF Atom