From 5bc42442a978180c14218af9fec26494a6b84abb Mon Sep 17 00:00:00 2001 From: Clay Gerrard Date: Fri, 3 Sep 2010 10:17:55 -0500 Subject: [PATCH] updated skipped tests in test.unit.obj.test_server to raise nose.SkipTest --- setup.cfg | 5 +++++ test/unit/obj/test_server.py | 37 +++++++++++++++++----------------- test/unit/proxy/test_server.py | 3 ++- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/setup.cfg b/setup.cfg index d53addcbf3..6671e0c70f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,3 +7,8 @@ source-dir = doc/source tag_build = tag_date = 0 tag_svn_revision = 0 + +[nosetests] +with-coverage=1 +cover-package=swift +verbosity=2 diff --git a/test/unit/obj/test_server.py b/test/unit/obj/test_server.py index 17308c614a..b165c107d3 100644 --- a/test/unit/obj/test_server.py +++ b/test/unit/obj/test_server.py @@ -19,6 +19,7 @@ import cPickle as pickle import os import sys import unittest +from nose import SkipTest from shutil import rmtree from StringIO import StringIO from time import gmtime, sleep, strftime, time @@ -64,7 +65,7 @@ class TestObjectController(unittest.TestCase): def test_POST_update_meta(self): """ Test swift.object_server.ObjectController.POST """ if not self.path_to_test_xfs: - return + raise SkipTest timestamp = normalize_timestamp(time()) req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'}, headers={'X-Timestamp': timestamp, @@ -92,7 +93,7 @@ class TestObjectController(unittest.TestCase): def test_POST_not_exist(self): if not self.path_to_test_xfs: - return + raise SkipTest timestamp = normalize_timestamp(time()) req = Request.blank('/sda1/p/a/c/fail', environ={'REQUEST_METHOD': 'POST'}, headers={'X-Timestamp': timestamp, @@ -114,7 +115,7 @@ class TestObjectController(unittest.TestCase): def test_POST_container_connection(self): if not self.path_to_test_xfs: - return + raise SkipTest def mock_http_connect(response, with_exc=False): class FakeConn(object): def __init__(self, status, with_exc): @@ -210,7 +211,7 @@ class TestObjectController(unittest.TestCase): def test_PUT_common(self): if not self.path_to_test_xfs: - return + raise SkipTest timestamp = normalize_timestamp(time()) req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'}, headers={'X-Timestamp': timestamp, @@ -267,7 +268,7 @@ class TestObjectController(unittest.TestCase): def test_PUT_no_etag(self): if not self.path_to_test_xfs: - return + raise SkipTest req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'}, headers={'X-Timestamp': normalize_timestamp(time()), 'Content-Type': 'text/plain'}) @@ -286,7 +287,7 @@ class TestObjectController(unittest.TestCase): def test_PUT_user_metadata(self): if not self.path_to_test_xfs: - return + raise SkipTest timestamp = normalize_timestamp(time()) req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'}, headers={'X-Timestamp': timestamp, @@ -314,7 +315,7 @@ class TestObjectController(unittest.TestCase): def test_PUT_container_connection(self): if not self.path_to_test_xfs: - return + raise SkipTest def mock_http_connect(response, with_exc=False): class FakeConn(object): def __init__(self, status, with_exc): @@ -443,7 +444,7 @@ class TestObjectController(unittest.TestCase): def test_GET(self): """ Test swift.object_server.ObjectController.GET """ if not self.path_to_test_xfs: - return + raise SkipTest req = Request.blank('/sda1/p/a/c') resp = self.object_controller.GET(req) self.assertEquals(resp.status_int, 400) @@ -532,7 +533,7 @@ class TestObjectController(unittest.TestCase): def test_GET_if_match(self): if not self.path_to_test_xfs: - return + raise SkipTest req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'}, headers={ 'X-Timestamp': normalize_timestamp(time()), @@ -586,7 +587,7 @@ class TestObjectController(unittest.TestCase): def test_GET_if_none_match(self): if not self.path_to_test_xfs: - return + raise SkipTest req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'}, headers={ 'X-Timestamp': normalize_timestamp(time()), @@ -637,7 +638,7 @@ class TestObjectController(unittest.TestCase): def test_GET_if_modified_since(self): if not self.path_to_test_xfs: - return + raise SkipTest timestamp = normalize_timestamp(time()) req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'}, headers={ @@ -674,7 +675,7 @@ class TestObjectController(unittest.TestCase): def test_GET_if_unmodified_since(self): if not self.path_to_test_xfs: - return + raise SkipTest timestamp = normalize_timestamp(time()) req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'}, headers={ @@ -713,7 +714,7 @@ class TestObjectController(unittest.TestCase): def test_DELETE(self): """ Test swift.object_server.ObjectController.DELETE """ if not self.path_to_test_xfs: - return + raise SkipTest req = Request.blank('/sda1/p/a/c', environ={'REQUEST_METHOD': 'DELETE'}) resp = self.object_controller.DELETE(req) self.assertEquals(resp.status_int, 400) @@ -840,7 +841,7 @@ class TestObjectController(unittest.TestCase): def test_chunked_put(self): if not self.path_to_test_xfs: - return + raise SkipTest listener = listen(('localhost', 0)) port = listener.getsockname()[1] killer = spawn(wsgi.server, listener, self.object_controller, @@ -887,7 +888,7 @@ class TestObjectController(unittest.TestCase): def test_disk_file_app_iter_corners(self): if not self.path_to_test_xfs: - return + raise SkipTest df = object_server.DiskFile(self.testdir, 'sda1', '0', 'a', 'c', 'o') mkdirs(df.datadir) f = open(os.path.join(df.datadir, @@ -920,7 +921,7 @@ class TestObjectController(unittest.TestCase): def test_max_upload_time(self): if not self.path_to_test_xfs: - return + raise SkipTest class SlowBody(): def __init__(self): self.sent = 0 @@ -962,7 +963,7 @@ class TestObjectController(unittest.TestCase): def test_bad_sinces(self): if not self.path_to_test_xfs: - return + raise SkipTest req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'}, headers={'X-Timestamp': normalize_timestamp(time()), 'Content-Length': '4', 'Content-Type': 'text/plain'}, @@ -988,7 +989,7 @@ class TestObjectController(unittest.TestCase): def test_content_encoding(self): if not self.path_to_test_xfs: - return + raise SkipTest req = Request.blank('/sda1/p/a/c/o', environ={'REQUEST_METHOD': 'PUT'}, headers={'X-Timestamp': normalize_timestamp(time()), 'Content-Length': '4', 'Content-Type': 'text/plain', diff --git a/test/unit/proxy/test_server.py b/test/unit/proxy/test_server.py index ab56dc740a..ce75c2014d 100644 --- a/test/unit/proxy/test_server.py +++ b/test/unit/proxy/test_server.py @@ -19,6 +19,7 @@ import logging import os import sys import unittest +from nose import SkipTest from ConfigParser import ConfigParser from contextlib import contextmanager from cStringIO import StringIO @@ -1052,7 +1053,7 @@ class TestObjectController(unittest.TestCase): 'pointing to a valid directory.\n' \ 'Please set PATH_TO_TEST_XFS to a directory on an XFS file ' \ 'system for testing.' - return + raise SkipTest testdir = \ os.path.join(path_to_test_xfs, 'tmp_test_proxy_server_chunked') mkdirs(testdir)