Permalink
Browse files

Normalize nosetests; 100% coverage.

  • Loading branch information...
mcdonc committed Mar 3, 2010
1 parent acc2c4a commit c1ee6ea5eb40dc228a6a722a5db8e4e5d61c09ed
Showing with 9 additions and 21 deletions.
  1. +7 −20 repoze/profile/tests.py
  2. +2 −1 setup.cfg
View
@@ -128,7 +128,7 @@ def test_index_withstats(self):
open(f, 'w').write('x')
middleware.log_filename = f
environ['PATH_INFO'] = middleware.path
- html = middleware.index(environ)
+ middleware.index(environ)
self.assertEqual(stats.stripped, True)
self.failIfEqual(stats.stream, True)
self.assertEqual(stats.printlimit, 500)
@@ -196,11 +196,11 @@ def test_call_discard_first_request(self):
def start_response(status, headers, exc_info=None):
statuses.append(status)
headerses.append(headers)
- iterable = middleware(environ, start_response)
+ middleware(environ, start_response)
self.assertEqual(statuses[0], '200 OK')
self.failIf(middleware.first_request)
self.failIf(os.path.exists(log_filename))
- another = middleware(environ, start_response)
+ middleware(environ, start_response)
self.failUnless(os.path.exists(log_filename))
os.remove(log_filename)
@@ -229,15 +229,15 @@ def test_call_keep_first_request(self):
def start_response(status, headers, exc_info=None):
statuses.append(status)
headerses.append(headers)
- iterable = middleware(environ, start_response)
+ middleware(environ, start_response)
self.assertEqual(statuses[0], '200 OK')
self.failIf(middleware.first_request)
self.failUnless(os.path.exists(log_filename))
os.remove(log_filename)
def test_call_with_cachegrind(self):
from repoze.profile.profiler import HAS_PP2CT
- if not HAS_PP2CT:
+ if not HAS_PP2CT: # pragma: no cover
return
import os
from StringIO import StringIO
@@ -265,7 +265,7 @@ def test_call_with_cachegrind(self):
def start_response(status, headers, exc_info=None):
statuses.append(status)
headerses.append(headers)
- iterable = middleware(environ, start_response)
+ middleware(environ, start_response)
self.assertEqual(statuses[0], '200 OK')
self.failIf(middleware.first_request)
self.failUnless(os.path.exists(log_filename))
@@ -275,7 +275,6 @@ def start_response(status, headers, exc_info=None):
def test_flush_at_shutdown(self):
import os
- from StringIO import StringIO
import tempfile
fields = [
('full_dirs', '1'),
@@ -284,11 +283,6 @@ def test_flush_at_shutdown(self):
('mode', 'callers'),
]
content_type, body = encode_multipart_formdata(fields)
- environ = self._makeEnviron(
- {'wsgi.input':StringIO(body),
- 'CONTENT_TYPE':content_type,
- 'CONTENT_LENGTH':len(body),
- })
log_filename = tempfile.mktemp()
middleware = self._makeOne(app, flush_at_shutdown=True,
log_filename=log_filename)
@@ -299,7 +293,6 @@ def test_flush_at_shutdown(self):
def test_keep_at_shutdown(self):
import os
- from StringIO import StringIO
import tempfile
fields = [
('full_dirs', '1'),
@@ -308,11 +301,6 @@ def test_keep_at_shutdown(self):
('mode', 'callers'),
]
content_type, body = encode_multipart_formdata(fields)
- environ = self._makeEnviron(
- {'wsgi.input':StringIO(body),
- 'CONTENT_TYPE':content_type,
- 'CONTENT_LENGTH':len(body),
- })
log_filename = tempfile.mktemp()
middleware = self._makeOne(app, flush_at_shutdown=False,
log_filename=log_filename)
@@ -348,8 +336,7 @@ def app(environ, start_response, exc_info=None):
class closeable(list):
closed = False
- def close(self):
- self.closed = True
+ def close(self): self.closed = True
def encode_multipart_formdata(fields):
BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'
View
@@ -1,6 +1,7 @@
[nosetests]
+where=repoze/profile
+match=^test
nocapture=1
cover-package=repoze.profile
-with-coverage=1
cover-erase=1

0 comments on commit c1ee6ea

Please sign in to comment.