summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/__init__.py18
-rw-r--r--test/build_python.sh6
-rw-r--r--test/test_auth.py2
-rw-r--r--test/test_config.py11
-rwxr-xr-xtest/test_environ.py2
-rw-r--r--test/test_jinja2.py2
-rw-r--r--test/test_mako.py2
-rw-r--r--test/test_mount.py2
-rwxr-xr-xtest/test_outputfilter.py2
-rw-r--r--test/test_plugins.py2
-rw-r--r--test/test_route.py2
-rw-r--r--test/test_server.py5
-rwxr-xr-xtest/test_stpl.py2
-rwxr-xr-xtest/test_wsgi.py2
-rwxr-xr-xtest/testall.py13
-rwxr-xr-xtest/tools.py3
16 files changed, 22 insertions, 54 deletions
diff --git a/test/__init__.py b/test/__init__.py
index 7ef1b19..e0ec347 100644
--- a/test/__init__.py
+++ b/test/__init__.py
@@ -1,6 +1,5 @@
from __future__ import with_statement
-from glob import glob
-from tools import chdir
+from .tools import chdir
import unittest
import sys, os
@@ -15,17 +14,6 @@ if 'fast' in sys.argv:
sys.stderr.write("Warning: The 'fast' keyword skipps server tests.\n")
os.environ["TEST_FAST"] = "true"
-suite = None
-if sys.version_info[:2] in ((2,5), (2,6), (3,1)):
- with chdir(__file__):
- suite = unittest.defaultTestLoader.loadTestsFromNames([n[:-3] for n in glob('test_*.py')])
-else:
- suite = unittest.defaultTestLoader.discover(__name__)
-
-def main():
- import bottle
- bottle.debug(True)
- vlevel = 2 if 'verbose' in sys.argv else 0
- result = unittest.TextTestRunner(verbosity=vlevel).run(suite)
- sys.exit((result.errors or result.failures) and 1 or 0)
+import bottle
+bottle.debug(True)
diff --git a/test/build_python.sh b/test/build_python.sh
index 876b9d2..45b9653 100644
--- a/test/build_python.sh
+++ b/test/build_python.sh
@@ -25,12 +25,12 @@ fi
pushd $PREFIX || exit 1
echo "Downloading source ..."
- wget -N http://hg.python.org/cpython/archive/$VERSION.tar.gz || exit 1
+ wget -N https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tgz || exit 1
echo "Extracting source ..."
- tar -xzf $VERSION.tar.gz || exit 1
+ tar -xzf Python-$VERSION.tgz || exit 1
- pushd cpython-$VERSION || exit 1
+ pushd Python-$VERSION || exit 1
echo "Running ./configure --prefix=$PREFIX ..."
./configure --prefix=$PREFIX || exit 1
diff --git a/test/test_auth.py b/test/test_auth.py
index e07ffb5..d3592f6 100644
--- a/test/test_auth.py
+++ b/test/test_auth.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
import bottle
-from tools import ServerTestBase
+from .tools import ServerTestBase
class TestBasicAuth(ServerTestBase):
diff --git a/test/test_config.py b/test/test_config.py
index 96b6e95..e8ed5fa 100644
--- a/test/test_config.py
+++ b/test/test_config.py
@@ -1,12 +1,5 @@
-import os
-import sys
import tempfile
import unittest
-
-import functools
-
-import itertools
-
from bottle import ConfigDict
@@ -92,11 +85,11 @@ class TestConfDict(unittest.TestCase):
def test_load_module(self):
c = ConfigDict()
- c.load_module('example_settings', True)
+ c.load_module('test.example_settings', True)
self.assertEqual(c['A.B.C'], 3)
c = ConfigDict()
- c.load_module('example_settings', False)
+ c.load_module('test.example_settings', False)
self.assertEqual(c['A']['B']['C'], 3)
def test_overlay(self):
diff --git a/test/test_environ.py b/test/test_environ.py
index e46b487..d3bebde 100755
--- a/test/test_environ.py
+++ b/test/test_environ.py
@@ -8,7 +8,7 @@ import itertools
import bottle
from bottle import request, tob, touni, tonat, json_dumps, HTTPError, parse_date
-import tools
+from . import tools
import wsgiref.util
import base64
diff --git a/test/test_jinja2.py b/test/test_jinja2.py
index dfac9bd..751b9e8 100644
--- a/test/test_jinja2.py
+++ b/test/test_jinja2.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import unittest
from bottle import Jinja2Template, jinja2_template, jinja2_view, touni
-from tools import warn, chdir
+from .tools import warn, chdir
diff --git a/test/test_mako.py b/test/test_mako.py
index 86f11bd..66de493 100644
--- a/test/test_mako.py
+++ b/test/test_mako.py
@@ -1,6 +1,6 @@
from __future__ import with_statement
import unittest
-from tools import warn, chdir
+from .tools import warn, chdir
from bottle import MakoTemplate, mako_template, mako_view, touni
class TestMakoTemplate(unittest.TestCase):
diff --git a/test/test_mount.py b/test/test_mount.py
index 4eb5178..582c087 100644
--- a/test/test_mount.py
+++ b/test/test_mount.py
@@ -1,5 +1,5 @@
import bottle
-from tools import ServerTestBase
+from .tools import ServerTestBase
from bottle import response
class TestAppMounting(ServerTestBase):
diff --git a/test/test_outputfilter.py b/test/test_outputfilter.py
index b95ab4b..cb752b1 100755
--- a/test/test_outputfilter.py
+++ b/test/test_outputfilter.py
@@ -4,7 +4,7 @@
import unittest
import bottle
from bottle import tob, touni
-from tools import ServerTestBase, tobs, warn
+from .tools import ServerTestBase, tobs, warn
class TestOutputFilter(ServerTestBase):
''' Tests for WSGI functionality, routing and output casting (decorators) '''
diff --git a/test/test_plugins.py b/test/test_plugins.py
index b756a22..c2609fd 100644
--- a/test/test_plugins.py
+++ b/test/test_plugins.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
import unittest
-import tools
+from . import tools
from bottle import HTTPResponse, HTTPError
diff --git a/test/test_route.py b/test/test_route.py
index 477e803..9819d36 100644
--- a/test/test_route.py
+++ b/test/test_route.py
@@ -1,6 +1,6 @@
import unittest
import bottle
-from tools import api
+from .tools import api
from bottle import _re_flatten
diff --git a/test/test_server.py b/test/test_server.py
index 610006c..63699ae 100644
--- a/test/test_server.py
+++ b/test/test_server.py
@@ -1,14 +1,13 @@
# -*- coding: utf-8 -*-
import unittest
import time
-from tools import tob
import sys
import os
import signal
import socket
from subprocess import Popen, PIPE
-import tools
-from bottle import server_names
+from . import tools
+from bottle import server_names, tob
try:
from urllib.request import urlopen
diff --git a/test/test_stpl.py b/test/test_stpl.py
index ab39b27..73f37d3 100755
--- a/test/test_stpl.py
+++ b/test/test_stpl.py
@@ -4,7 +4,7 @@ import unittest
from bottle import SimpleTemplate, TemplateError, view, template, touni, tob, html_quote
import re, os
import traceback
-from tools import chdir
+from .tools import chdir
class TestSimpleTemplate(unittest.TestCase):
diff --git a/test/test_wsgi.py b/test/test_wsgi.py
index 95b97da..2af46d4 100755
--- a/test/test_wsgi.py
+++ b/test/test_wsgi.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import with_statement
import bottle
-from tools import ServerTestBase, chdir
+from .tools import ServerTestBase, chdir
from bottle import tob, touni
class TestWsgi(ServerTestBase):
diff --git a/test/testall.py b/test/testall.py
deleted file mode 100755
index ad6b667..0000000
--- a/test/testall.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import os, sys
-
-sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
-
-import test
-print (test.__file__)
-suite = test.suite
-
-if __name__ == '__main__':
- test.main()
diff --git a/test/tools.py b/test/tools.py
index 832624b..a66315c 100755
--- a/test/tools.py
+++ b/test/tools.py
@@ -37,6 +37,7 @@ class chdir(object):
def __exit__(self, exc_type, exc_val, tb):
os.chdir(self.old)
+
class assertWarn(object):
def __init__(self, text):
self.searchtext = text
@@ -49,7 +50,7 @@ class assertWarn(object):
def __enter__(self):
self.orig = bottle.depr
- bottle.depr = self.dept
+ bottle.depr = self.depr
self.warnings = []
def depr(self, msg, strict=False):