[Python-modules-commits] [gamera] 05/17: nosetests

Daniel Stender stender at moszumanska.debian.org
Tue Apr 26 18:43:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

stender pushed a commit to branch master
in repository gamera.

commit 33721c479065dd18fb8a35119e71cce0cd2ab9f4
Author: Jakub Wilk <jwilk at debian.org>
Date:   Sat Oct 17 18:42:54 2015 +0200

    nosetests
    
       port the test suite to nose
       Bug-Debian: http://bugs.debian.org/664670
       Forwarded: not-needed
---
 tests/py/__init__.py  |  1 +
 tests/py/test.py      |  1 +
 tests/test_graph.py   | 12 +++++++-----
 tests/test_image.py   |  3 +++
 tests/test_plugins.py |  7 ++++++-
 5 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/tests/py/__init__.py b/tests/py/__init__.py
new file mode 100644
index 0000000..792d600
--- /dev/null
+++ b/tests/py/__init__.py
@@ -0,0 +1 @@
+#
diff --git a/tests/py/test.py b/tests/py/test.py
new file mode 100644
index 0000000..cf7a2a8
--- /dev/null
+++ b/tests/py/test.py
@@ -0,0 +1 @@
+from nose.tools import assert_raises as raises
diff --git a/tests/test_graph.py b/tests/test_graph.py
index fcff910..c698b7c 100644
--- a/tests/test_graph.py
+++ b/tests/test_graph.py
@@ -1083,7 +1083,9 @@ def _make_test_size(t, flag, size):
 #small tests
 for test in tests_small:
    for flag in flags:
-      setattr(TestGraph, "test_small_%d_%s" % (flag, test.__name__ ), _make_test(test,flag))
+      f = _make_test(test,flag)
+      f.__name__ = "test_small_%d_%s" % (flag, test.__name__)
+      setattr(TestGraph, f.__name__, f)
 
 #large default
 #for test in tests_large:
@@ -1094,10 +1096,10 @@ for test in tests_small:
 for size in [512]:
    for test in tests_large:
       for flag in flags:
-         setattr(TestGraph, "test_large_%d_%d_%s" % (flag, size, test.__name__ ), 
-                 _make_test_size(test, flag, size))
-   
-
+         f = _make_test_size(test, flag, size)
+         f.__name__ = "test_large_%d_%d_%s" % (flag, size, test.__name__)
+         setattr(TestGraph, f.__name__, f)
+del f, test
 
 
 
diff --git a/tests/test_image.py b/tests/test_image.py
index 7f46252..0109197 100644
--- a/tests/test_image.py
+++ b/tests/test_image.py
@@ -20,6 +20,7 @@ def make_test(inner):
                           (GREY16, xrange((2 ** 16) - 1))]:
          inner(type, value, DENSE)
       inner(ONEBIT, xrange(0, 2 ** 16 - 1), RLE)
+   test.__name__ = inner.__name__.lstrip('_')
    return test
 
 def _test_image_constructors(type, value, storage):
@@ -150,3 +151,5 @@ def test_conversions():
     assert tmp.get((0,0)) == 0
     assert tmp.get((5,5)) == 85
     assert tmp.get((9,9)) == 255
+
+del make_test
diff --git a/tests/test_plugins.py b/tests/test_plugins.py
index add8312..b19f3d8 100644
--- a/tests/test_plugins.py
+++ b/tests/test_plugins.py
@@ -22,4 +22,9 @@ def make_test(tester, method):
 
 tester = PluginTester()
 for name, method in tester.methods:
-   setattr(TestPlugins, "test_plugin_" + name, make_test(tester, method))
+   f = make_test(tester, method)
+   f.__name__ = "test_plugin_" + name
+   setattr(TestPlugins, f.__name__, f)
+del f
+
+del make_test

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/gamera.git



More information about the Python-modules-commits mailing list