Skip to content

Commit

Permalink
Merge pull request bottlepy#489 from fatiherikli/master
Browse files Browse the repository at this point in the history
Some fixes on tests
  • Loading branch information
defnull committed Apr 22, 2013
2 parents b4c243e + ddce3a8 commit 59717d6
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 21 deletions.
1 change: 0 additions & 1 deletion test/test_auth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
import unittest
import bottle
from tools import ServerTestBase

Expand Down
5 changes: 2 additions & 3 deletions test/test_environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
''' Tests for the BaseRequest and BaseResponse objects and their subclasses. '''

import unittest
import sys, os.path
import sys
import bottle
from bottle import request, response, tob, touni, tonat, json_dumps, _e, HTTPError
from bottle import request, tob, touni, tonat, json_dumps, _e, HTTPError
import tools
import wsgiref.util
import threading
import base64

from bottle import BaseRequest, BaseResponse, LocalRequest
Expand Down
2 changes: 1 addition & 1 deletion test/test_mount.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import bottle
from tools import ServerTestBase
from bottle import Bottle, response
from bottle import response

class TestAppMounting(ServerTestBase):
def setUp(self):
Expand Down
1 change: 0 additions & 1 deletion test/test_plugins.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import unittest
import bottle
import tools


Expand Down
2 changes: 0 additions & 2 deletions test/test_resources.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import bottle
from tools import ServerTestBase
from bottle import ResourceManager
import os.path
import unittest
Expand Down
5 changes: 3 additions & 2 deletions test/test_router.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import unittest
import bottle


class TestRouter(unittest.TestCase):
CGI=False
CGI = False

def setUp(self):
self.r = bottle.Router()
Expand Down Expand Up @@ -130,5 +131,5 @@ class TestRouterInCGIMode(TestRouter):
CGI = True


if __name__ == '__main__': #pragma: no cover
if __name__ == '__main__': # pragma: no cover
unittest.main()
1 change: 1 addition & 0 deletions test/test_securecookies.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#coding: utf-8
import unittest

import bottle
from bottle import tob, touni

Expand Down
3 changes: 1 addition & 2 deletions test/test_sendfile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import unittest
from bottle import static_file, HTTPError, HTTPResponse, request, response, parse_date, parse_range_header, Bottle, tob
from bottle import static_file, request, response, parse_date, parse_range_header, Bottle, tob
import wsgiref.util
import os
import os.path
import tempfile
import time

Expand Down
3 changes: 1 addition & 2 deletions test/test_server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import unittest
import bottle
import time
from tools import tob
import sys
Expand Down Expand Up @@ -119,7 +118,7 @@ class TestRocketServer(TestServer):
class TestFapwsServer(TestServer):
server = 'fapws3'

class TestFapwsServer(TestServer):
class MeinheldServer(TestServer):
server = 'meinheld'

class TestBjoernServer(TestServer):
Expand Down
1 change: 0 additions & 1 deletion test/test_wsgi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import unittest
import sys, os.path
import bottle
from tools import ServerTestBase
from bottle import tob
Expand Down
10 changes: 7 additions & 3 deletions test/testall.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,23 @@
''')
sys.exit(0)


if 'fast' in sys.argv:
sys.stderr.write("Warning: The 'fast' keyword skipps server tests.\n")
test_names.remove('test_server')

cov = None
if 'coverage' in sys.argv:
import coverage

cov = coverage.coverage(data_suffix=True, branch=True)
cov.start()

suite = unittest.defaultTestLoader.loadTestsFromNames(test_names)


def run():
import bottle

bottle.debug(True)
vlevel = 2 if 'verbose' in sys.argv else 0
result = unittest.TextTestRunner(verbosity=vlevel).run(suite)
Expand All @@ -48,13 +50,15 @@ def run():
# recognized
cnew = coverage.coverage(data_suffix=True, branch=True)
cnew.combine()
cnew.report(morfs=['bottle.py']+test_files, show_missing=False)
cnew.report(morfs=['bottle.py'] + test_files, show_missing=False)
if 'html' in sys.argv:
print
cnew.html_report(morfs=['bottle.py']+test_files, directory='../build/coverage')
cnew.html_report(morfs=['bottle.py'] + test_files,
directory='../build/coverage')

sys.exit((result.errors or result.failures) and 1 or 0)


if __name__ == '__main__':
run()

3 changes: 0 additions & 3 deletions test/tools.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# -*- coding: utf-8 -*-
import bottle
import threading
import sys
import time
import unittest
import wsgiref
import wsgiref.simple_server
import wsgiref.util
import wsgiref.validate

Expand Down

0 comments on commit 59717d6

Please sign in to comment.