Merge lp:~jbaker/storm/nose_plugin into lp:storm

Proposed by Jason Baker
Status: Needs review
Proposed branch: lp:~jbaker/storm/nose_plugin
Merge into: lp:storm
Diff against target: 80 lines (+50/-1)
2 files modified
setup.py (+13/-1)
storm/nose_plugin.py (+37/-0)
To merge this branch: bzr merge lp:~jbaker/storm/nose_plugin
Reviewer Review Type Date Requested Status
Storm Developers Pending
Storm Developers Pending
Review via email: mp+15506@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jason Baker (jbaker) wrote :

This branch adds a nose plugin to aid writing tests using storm. It allows users to turn the debug setting on by a command-line switch.

Unmerged revisions

353. By Jason Baker <jason@ubuntu>

Adding nose plugin.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'setup.py'
2--- setup.py 2008-06-16 11:21:02 +0000
3+++ setup.py 2009-12-01 19:05:23 +0000
4@@ -4,8 +4,10 @@
5
6 try:
7 from setuptools import setup, Extension
8+ use_setuptools = True
9 except ImportError:
10 from distutils.core import setup, Extension
11+ use_setuptools = False
12
13
14 if os.path.isfile("MANIFEST"):
15@@ -28,6 +30,15 @@
16 packages.append(directory.replace(os.sep, '.'))
17 return packages
18
19+if use_setuptools:
20+ setuptools_kwargs = {
21+ 'entry_points' : {
22+ 'nose.plugins.0.10' : [
23+ 'storm_debug = storm.nose_plugin:StormDebug'],
24+ }
25+ }
26+else:
27+ setuptools_kwargs = {}
28
29 setup(
30 name="storm",
31@@ -54,5 +65,6 @@
32 "Topic :: Software Development :: Libraries :: Python Modules",
33 ],
34 ext_modules=(BUILD_CEXTENSIONS and
35- [Extension("storm.cextensions", ["storm/cextensions.c"])])
36+ [Extension("storm.cextensions", ["storm/cextensions.c"])]),
37+ **setuptools_kwargs
38 )
39
40=== added file 'storm/nose_plugin.py'
41--- storm/nose_plugin.py 1970-01-01 00:00:00 +0000
42+++ storm/nose_plugin.py 2009-12-01 19:05:23 +0000
43@@ -0,0 +1,37 @@
44+#
45+# Copyright (c) 2006, 2007 Canonical
46+#
47+# Written by Gustavo Niemeyer <gustavo@niemeyer.net>
48+#
49+# This file is part of Storm Object Relational Mapper.
50+#
51+# Storm is free software; you can redistribute it and/or modify
52+# it under the terms of the GNU Lesser General Public License as
53+# published by the Free Software Foundation; either version 2.1 of
54+# the License, or (at your option) any later version.
55+#
56+# Storm is distributed in the hope that it will be useful,
57+# but WITHOUT ANY WARRANTY; without even the implied warranty of
58+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
59+# GNU Lesser General Public License for more details.
60+#
61+# You should have received a copy of the GNU Lesser General Public License
62+# along with this program. If not, see <http://www.gnu.org/licenses/>.
63+#
64+"""
65+This module contains a plugin to support enabling sql debugging.
66+"""
67+
68+import sys
69+from nose.plugins.base import Plugin
70+from storm.tracer import debug
71+
72+class StormDebug(Plugin):
73+ """
74+ Enable outputting storm debug info.
75+ """
76+ def begin(self):
77+ if self.enabled:
78+ debug(True, sys.stdout)
79+ else:
80+ debug(False, sys.stdout)

Subscribers

People subscribed via source and target branches

to status/vote changes: