summaryrefslogtreecommitdiff
path: root/tests/test_generictreemodel.py
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-02-10 11:37:55 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2018-02-10 11:38:45 +0100
commit11de6f55f48447325325ec2f334af5576d12e2ed (patch)
tree586194afdf198bc6f4773fc480fbdfc64a2250aa /tests/test_generictreemodel.py
parent9a9bb732752e7bec42a1c13f080b37536876e3e0 (diff)
downloadpygobject-11de6f55f48447325325ec2f334af5576d12e2ed.tar.gz
tests: switch to pytest as the default test runner. See #153
The TEST_NAMES env var gets translated to work with the pytest syntax (foo.py::class::method). Rename one class which triggers a pytest warning because it starts with "Test" but isn't one. Remove erroring out on Python warnings as pytest triggers some deprecation warnings by default.
Diffstat (limited to 'tests/test_generictreemodel.py')
-rw-r--r--tests/test_generictreemodel.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/test_generictreemodel.py b/tests/test_generictreemodel.py
index 30ae1250..24301109 100644
--- a/tests/test_generictreemodel.py
+++ b/tests/test_generictreemodel.py
@@ -55,9 +55,9 @@ class Node(object):
return 'Node("%s", %s)' % (self.name, self.value)
-class TesterModel(GenericTreeModel):
+class ATesterModel(GenericTreeModel):
def __init__(self):
- super(TesterModel, self).__init__()
+ super(ATesterModel, self).__init__()
self.root = Node('root', 0,
Node('spam', 1,
Node('sushi', 2),
@@ -150,7 +150,7 @@ class TestReferences(unittest.TestCase):
self.assertEqual(sys.getrefcount(obj), ref_count + 1)
def test_leak_references_on(self):
- model = TesterModel()
+ model = ATesterModel()
obj_ref = weakref.ref(model.root)
# Initial refcount is 1 for model.root + the temporary
self.assertEqual(sys.getrefcount(model.root), 2)
@@ -179,7 +179,7 @@ class TestReferences(unittest.TestCase):
self.assertEqual(obj_ref(), None)
def test_row_deleted_frees_refs(self):
- model = TesterModel()
+ model = ATesterModel()
obj_ref = weakref.ref(model.root)
# Initial refcount is 1 for model.root + the temporary
self.assertEqual(sys.getrefcount(model.root), 2)
@@ -200,7 +200,7 @@ class TestReferences(unittest.TestCase):
self.assertEqual(obj_ref(), None)
def test_leak_references_off(self):
- model = TesterModel()
+ model = ATesterModel()
model.leak_references = False
obj_ref = weakref.ref(model.root)
@@ -226,7 +226,7 @@ class TestReferences(unittest.TestCase):
def test_iteration_refs(self):
# Pull iterators off the model using the wrapped C API which will
# then call back into the python overrides.
- model = TesterModel()
+ model = ATesterModel()
nodes = [node for node in model.iter_depth_first()]
values = [node.value for node in nodes]
@@ -287,7 +287,7 @@ class TestReferences(unittest.TestCase):
@unittest.skipUnless(has_gtk, 'Gtk not available')
class TestIteration(unittest.TestCase):
def test_iter_next_root(self):
- model = TesterModel()
+ model = ATesterModel()
it = model.get_iter([0])
self.assertEqual(it.user_data, id(model.root))
self.assertEqual(model.root.next, None)
@@ -296,7 +296,7 @@ class TestIteration(unittest.TestCase):
self.assertEqual(it, None)
def test_iter_next_multiple(self):
- model = TesterModel()
+ model = ATesterModel()
it = model.get_iter([0, 0])
self.assertEqual(it.user_data, id(model.root.children[0]))