diff options
author | pjenvey <devnull@localhost> | 2009-05-07 06:33:36 +0000 |
---|---|---|
committer | pjenvey <devnull@localhost> | 2009-05-07 06:33:36 +0000 |
commit | 1e62b90f2ab0d0f02c1b239371292e3b7dab02df (patch) | |
tree | ce55df29dfe17d91f2732b3857024fe52c8e87a5 /tests | |
parent | 9a56546c530f2ea657d79b8a4b0ae17efcad17bd (diff) | |
download | paste-1e62b90f2ab0d0f02c1b239371292e3b7dab02df.tar.gz |
convert to nose 0.11
Diffstat (limited to 'tests')
-rw-r--r-- | tests/__init__.py | 7 | ||||
-rw-r--r-- | tests/conftest.py | 28 | ||||
-rw-r--r-- | tests/test_auth/__init__.py | 0 | ||||
-rw-r--r-- | tests/test_cgiapp.py | 4 | ||||
-rw-r--r-- | tests/test_config.py | 6 | ||||
-rw-r--r-- | tests/test_exceptions/test_httpexceptions.py | 6 | ||||
-rw-r--r-- | tests/test_multidict.py | 6 | ||||
-rw-r--r-- | tests/test_registry.py | 4 | ||||
-rw-r--r-- | tests/test_request.py | 1 | ||||
-rw-r--r-- | tests/test_util/__init__.py | 0 |
10 files changed, 20 insertions, 42 deletions
diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..3e2e36a --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,7 @@ +import sys +import os + +sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) + +import pkg_resources +pkg_resources.require('Paste') diff --git a/tests/conftest.py b/tests/conftest.py deleted file mode 100644 index e639ec1..0000000 --- a/tests/conftest.py +++ /dev/null @@ -1,28 +0,0 @@ -import sys -import os - -sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) - -import pkg_resources -pkg_resources.require('Paste') - -import py -""" -Option = py.test.Config.Option -option = py.test.Config.addoptions( - "Paste options", - Option('-W', - action="store_true", dest="raise_warnings", - default=False, - help="Turn warnings into errors")) - -class SetupDirectory(py.test.collect.Directory): - - def __init__(self, *args, **kw): - super(SetupDirectory, self).__init__(*args, **kw) - if option.raise_warnings: - import warnings - warnings.filterwarnings('error') - -Directory = SetupDirectory -""" diff --git a/tests/test_auth/__init__.py b/tests/test_auth/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/test_auth/__init__.py diff --git a/tests/test_cgiapp.py b/tests/test_cgiapp.py index 14106c8..2887271 100644 --- a/tests/test_cgiapp.py +++ b/tests/test_cgiapp.py @@ -1,6 +1,6 @@ import os import sys -import py.test +from nose.tools import assert_raises from paste.cgiapp import CGIApplication, CGIError from paste.fixture import * @@ -25,7 +25,7 @@ if sys.platform != 'win32' and not sys.platform.startswith('java'): def test_error(): app = TestApp(CGIApplication({}, script='error.cgi', path=[data_dir])) - py.test.raises(CGIError, "app.get('', status=500)") + assert_raises(CGIError, app.get, '', status=500) def test_stderr(): app = TestApp(CGIApplication({}, script='stderr.cgi', path=[data_dir])) diff --git a/tests/test_config.py b/tests/test_config.py index 4c745e1..882f82c 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,6 +1,6 @@ # (c) 2007 Philip Jenvey; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php -from py.test import raises +from nose.tools import assert_raises from paste.config import CONFIG, ConfigMiddleware from paste.fixture import TestApp @@ -56,8 +56,8 @@ def test_process_config(request_app=test_request_config): assert CONFIG['process_var'] == 'foo' CONFIG.pop_process_config() - raises(AttributeError, lambda: 'process_var' not in CONFIG) - raises(IndexError, CONFIG.pop_process_config) + assert_raises(AttributeError, lambda: 'process_var' not in CONFIG) + assert_raises(IndexError, CONFIG.pop_process_config) def test_process_config_multi(): test_process_config(test_request_config_multi) diff --git a/tests/test_exceptions/test_httpexceptions.py b/tests/test_exceptions/test_httpexceptions.py index 5cb9319..c833eae 100644 --- a/tests/test_exceptions/test_httpexceptions.py +++ b/tests/test_exceptions/test_httpexceptions.py @@ -6,16 +6,16 @@ WSGI Exception Middleware Regression Test Suite """ +from nose.tools import assert_raises from paste.httpexceptions import * from paste.wsgilib import raw_interactive from paste.response import header_value -import py def test_HTTPMove(): """ make sure that location is a mandatory attribute of Redirects """ - py.test.raises(AssertionError,HTTPFound) - py.test.raises(AssertionError,HTTPTemporaryRedirect, + assert_raises(AssertionError, HTTPFound) + assert_raises(AssertionError, HTTPTemporaryRedirect, headers=[('l0cation','/bing')]) assert isinstance(HTTPMovedPermanently("This is a message", headers=[('Location','/bing')]) diff --git a/tests/test_multidict.py b/tests/test_multidict.py index 75933a5..c99b10f 100644 --- a/tests/test_multidict.py +++ b/tests/test_multidict.py @@ -2,11 +2,11 @@ # (c) 2007 Ian Bicking and Philip Jenvey; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php import cgi +from nose.tools import assert_raises from StringIO import StringIO from paste.fixture import TestApp from paste.wsgiwrappers import WSGIRequest from paste.util.multidict import MultiDict, UnicodeMultiDict -from py.test import raises def test_dict(): d = MultiDict({'a': 1}) @@ -20,7 +20,7 @@ def test_dict(): assert d.items() == [('a', 1), ('c', 3), ('b', 4)] d.add('b', 5) - raises(KeyError, 'd.getone("b")') + assert_raises(KeyError, d.getone, "b") assert d.getall('b') == [4, 5] assert d.items() == [('a', 1), ('c', 3), ('b', 4), ('b', 5)] @@ -91,7 +91,7 @@ def _test_unicode_dict(decode_param_names=False): map(assert_unicode_item, d.items()) d.add('b', '5 test') - raises(KeyError, 'd.getone("b")') + assert_raises(KeyError, d.getone, "b") assert d.getall('b') == [u'4 test', u'5 test'] map(assert_unicode, d.getall('b')) assert d.items() == [('a', u'a test'), ('c', u'3 test'), ('b', u'4 test'), diff --git a/tests/test_registry.py b/tests/test_registry.py index e82f1f6..d0dc8ac 100644 --- a/tests/test_registry.py +++ b/tests/test_registry.py @@ -1,7 +1,7 @@ # (c) 2005 Ben Bangert # This module is part of the Python Paste Project and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php -import py.test +from nose.tools import assert_raises from paste.fixture import * from paste.registry import * @@ -104,7 +104,7 @@ def test_solo_registry(): def test_registry_no_object_error(): app = TestApp(simpleapp_withregistry) - py.test.raises(TypeError, "app.get('/')") + assert_raises(TypeError, app.get, '/') def test_with_default_object(): app = TestApp(simpleapp_withregistry_default) diff --git a/tests/test_request.py b/tests/test_request.py index 697689c..c2cf940 100644 --- a/tests/test_request.py +++ b/tests/test_request.py @@ -4,7 +4,6 @@ from paste.fixture import * from paste.request import * from paste.wsgiwrappers import WSGIRequest -from py.test import raises def simpleapp(environ, start_response): status = '200 OK' diff --git a/tests/test_util/__init__.py b/tests/test_util/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/test_util/__init__.py |