99 lines
3.8 KiB
Diff
99 lines
3.8 KiB
Diff
From 41728025340a02643085adcbcecf986ad8667209 Mon Sep 17 00:00:00 2001
|
|
From: Scott Talbert <swt@techie.net>
|
|
Date: Tue, 17 Aug 2021 20:39:00 -0400
|
|
Subject: [PATCH] Fix warnings when running tests
|
|
|
|
---
|
|
tests/memory_mgmt_test.py | 4 ++--
|
|
tests/reload_test.py | 4 ++--
|
|
tests/setopt_lifecycle_test.py | 1 +
|
|
tests/setopt_test.py | 8 ++++----
|
|
4 files changed, 9 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/tests/memory_mgmt_test.py b/tests/memory_mgmt_test.py
|
|
index 416fd4c..ec841f2 100644
|
|
--- a/tests/memory_mgmt_test.py
|
|
+++ b/tests/memory_mgmt_test.py
|
|
@@ -297,7 +297,7 @@ class MemoryMgmtTest(unittest.TestCase):
|
|
|
|
gc.collect()
|
|
after_object_count = len(gc.get_objects())
|
|
- self.assert_(after_object_count <= before_object_count + 1000, 'Grew from %d to %d objects' % (before_object_count, after_object_count))
|
|
+ self.assertTrue(after_object_count <= before_object_count + 1000, 'Grew from %d to %d objects' % (before_object_count, after_object_count))
|
|
c.close()
|
|
|
|
def test_form_bufferptr_memory_leak_gh267(self):
|
|
@@ -317,7 +317,7 @@ class MemoryMgmtTest(unittest.TestCase):
|
|
|
|
gc.collect()
|
|
after_object_count = len(gc.get_objects())
|
|
- self.assert_(after_object_count <= before_object_count + 1000, 'Grew from %d to %d objects' % (before_object_count, after_object_count))
|
|
+ self.assertTrue(after_object_count <= before_object_count + 1000, 'Grew from %d to %d objects' % (before_object_count, after_object_count))
|
|
c.close()
|
|
|
|
def do_data_refcounting(self, option):
|
|
diff --git a/tests/reload_test.py b/tests/reload_test.py
|
|
index 3f037a1..e6c1fbc 100644
|
|
--- a/tests/reload_test.py
|
|
+++ b/tests/reload_test.py
|
|
@@ -14,6 +14,6 @@ class ReloadTest(unittest.TestCase):
|
|
reload_fn = reload
|
|
except NameError:
|
|
# python 3
|
|
- import imp
|
|
- reload_fn = imp.reload
|
|
+ import importlib
|
|
+ reload_fn = importlib.reload
|
|
reload_fn(pycurl)
|
|
diff --git a/tests/setopt_lifecycle_test.py b/tests/setopt_lifecycle_test.py
|
|
index 1adb70c..eacedc8 100644
|
|
--- a/tests/setopt_lifecycle_test.py
|
|
+++ b/tests/setopt_lifecycle_test.py
|
|
@@ -17,6 +17,7 @@ from . import util
|
|
setup_module, teardown_module = appmanager.setup(('app', 8380))
|
|
|
|
class TestString(str):
|
|
+ __test__ = False
|
|
def __del__(self):
|
|
self.replace('1', '2')
|
|
#print self
|
|
diff --git a/tests/setopt_test.py b/tests/setopt_test.py
|
|
index 29ae2f0..472cf34 100644
|
|
--- a/tests/setopt_test.py
|
|
+++ b/tests/setopt_test.py
|
|
@@ -58,13 +58,13 @@ class SetoptTest(unittest.TestCase):
|
|
io = util.BytesIO()
|
|
self.curl.setopt(self.curl.WRITEDATA, io)
|
|
self.curl.perform()
|
|
- self.assertEquals(util.b('foo'), io.getvalue())
|
|
+ self.assertEqual(util.b('foo'), io.getvalue())
|
|
|
|
self.curl.unsetopt(self.curl.HTTPHEADER)
|
|
io = util.BytesIO()
|
|
self.curl.setopt(self.curl.WRITEDATA, io)
|
|
self.curl.perform()
|
|
- self.assertEquals(util.b(''), io.getvalue())
|
|
+ self.assertEqual(util.b(''), io.getvalue())
|
|
|
|
def test_set_httpheader_none(self):
|
|
self.curl.setopt(self.curl.HTTPHEADER, ('x-test: foo',))
|
|
@@ -72,13 +72,13 @@ class SetoptTest(unittest.TestCase):
|
|
io = util.BytesIO()
|
|
self.curl.setopt(self.curl.WRITEDATA, io)
|
|
self.curl.perform()
|
|
- self.assertEquals(util.b('foo'), io.getvalue())
|
|
+ self.assertEqual(util.b('foo'), io.getvalue())
|
|
|
|
self.curl.setopt(self.curl.HTTPHEADER, None)
|
|
io = util.BytesIO()
|
|
self.curl.setopt(self.curl.WRITEDATA, io)
|
|
self.curl.perform()
|
|
- self.assertEquals(util.b(''), io.getvalue())
|
|
+ self.assertEqual(util.b(''), io.getvalue())
|
|
|
|
@util.min_libcurl(7, 37, 0)
|
|
def test_proxyheader_list(self):
|
|
--
|
|
2.31.1
|
|
|