summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hellkamp <marc@gsites.de>2018-10-25 18:45:44 +0200
committerMarcel Hellkamp <marc@gsites.de>2018-10-25 18:45:44 +0200
commit33d1b8359776a3777509bbcc4be0496c435c8e34 (patch)
treee41b2ae47016f55ce8566919c672fa13aa52b86c
parent774f376df74ce8e30cb4833ccaac95c5de11c243 (diff)
downloadbottle-33d1b8359776a3777509bbcc4be0496c435c8e34.tar.gz
Normalized test and build setup
-rw-r--r--.coveragerc2
-rw-r--r--.travis.yml6
-rw-r--r--Makefile82
-rw-r--r--README.rst2
-rw-r--r--circle.yml20
-rw-r--r--setup.cfg2
-rwxr-xr-xsetup.py7
-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
-rw-r--r--tox.ini4
24 files changed, 90 insertions, 111 deletions
diff --git a/.coveragerc b/.coveragerc
index 372eb95..68f60d0 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -1,4 +1,4 @@
[run]
branch = True
parallel = True
-source = bottle.py
+source = bottle
diff --git a/.travis.yml b/.travis.yml
index 5267996..cbeedb7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,13 +19,9 @@ install:
- travis_retry bash test/travis_setup.sh
script:
- - python -m coverage run --source=. test/testall.py fast
+ - python -m coverage run -m unittest discover
- python -m coverage combine
- python -m coverage report 2>&1
-notifications:
- irc: "irc.freenode.org#bottlepy"
- on_success: "never"
-
after_success:
coveralls
diff --git a/Makefile b/Makefile
index 7fe81e6..610ec3e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,23 +1,33 @@
-PATH := build/python/bin:$(PATH)
VERSION = $(shell python setup.py --version)
ALLFILES = $(shell echo bottle.py test/*.py test/views/*.tpl)
-
-.PHONY: release coverage install docs test test_all test_27 test_32 test_33 test_34 test_35 2to3 clean
-
-release: test_all
- python setup.py --version | egrep -q -v '[a-zA-Z]' # Fail on dev/rc versions
- git commit -e -m "Release of $(VERSION)" # Fail on nothing to commit
- git tag -a -m "Release of $(VERSION)" $(VERSION) # Fail on existing tags
- git push origin HEAD # Fail on out-of-sync upstream
- git push origin tag $(VERSION) # Fail on dublicate tag
- python setup.py sdist bdist_wheel register upload # Release to pypi
-
-coverage:
- python -m coverage erase
- python -m coverage run --source=bottle.py test/testall.py
- python -m coverage combine
- python -m coverage report
- python -m coverage html
+VENV = build/venv
+TESTBUILD = build/python
+
+.PHONY: venv release coverage install docs test test_all test_27 test_32 test_33 test_34 test_35 2to3 clean
+
+release: test_all venv
+ $(VENV)/bin/python3 setup.py --version | egrep -q -v '[a-zA-Z]' # Fail on dev/rc versions
+ git commit -e -m "Release of $(VERSION)" # Fail on nothing to commit
+ git tag -a -m "Release of $(VERSION)" $(VERSION) # Fail on existing tags
+ git push origin HEAD # Fail on out-of-sync upstream
+ git push origin tag $(VERSION) # Fail on dublicate tag
+ $(VENV)/bin/python3 setup.py sdist bdist_wheel # Build project
+ $(VENV)/bin/twine upload # Release to pypi
+
+venv: $(VENV)/.installed
+$(VENV)/.installed: Makefile
+ python3 -mvenv $(VENV)
+ $(VENV)/bin/python3 -mensurepip
+ $(VENV)/bin/pip install -U pip
+ $(VENV)/bin/pip install -U setuptools wheel twine coverage
+ touch $(VENV)/.installed
+
+coverage: venv
+ $(VENV)/bin/coverage erase
+ $(VENV)/bin/coverage run -m unittest discover
+ $(VENV)/bin/coverage combine
+ $(VENV)/bin/coverage report
+ $(VENV)/bin/coverage html
push: test_all
git push origin HEAD
@@ -28,35 +38,39 @@ install:
docs:
sphinx-build -b html -d build/docs/doctrees docs build/docs/html/;
-test:
- python test/testall.py
+test: venv
+ $(VENV)/bin/python3 -m unittest discover
-test_all: test_27 test_32 test_33 test_34 test_35
+test_all: test_27 test_32 test_33 test_34 test_35 test_37
test_27:
- python2.7 test/testall.py
-
-test_32:
- python3.2 test/testall.py
+ $(TESTBUILD)/bin/python2.7 -m unittest discover
test_33:
- python3.3 test/testall.py
+ $(TESTBUILD)/bin/python3.3 -m unittest discover
test_34:
- python3.4 test/testall.py
+ $(TESTBUILD)/bin/python3.4 -m unittest discover
test_35:
- python3.5 test/testall.py
+ $(TESTBUILD)/bin/python3.5 -m unittest discover
+
+test_36:
+ $(TESTBUILD)/bin/python3.6 -m unittest discover
+
+test_37:
+ $(TESTBUILD)/bin/python3.7 -m unittest discover
test_setup:
- bash test/build_python.sh 2.7 build/python
- bash test/build_python.sh 3.2 build/python
- bash test/build_python.sh 3.3 build/python
- bash test/build_python.sh 3.4 build/python
- bash test/build_python.sh 3.5 build/python
+ bash test/build_python.sh 2.7.3 $(TESTBUILD)
+ bash test/build_python.sh 3.3.7 $(TESTBUILD)
+ bash test/build_python.sh 3.4.9 $(TESTBUILD)
+ bash test/build_python.sh 3.5.6 $(TESTBUILD)
+ bash test/build_python.sh 3.6.7 $(TESTBUILD)
+ bash test/build_python.sh 3.7.1 $(TESTBUILD)
clean:
- rm -rf build/ dist/ MANIFEST 2>/dev/null || true
+ rm -rf $(VENV) build/ dist/ MANIFEST .coverage .name htmlcov 2>/dev/null || true
find . -name '__pycache__' -exec rm -rf {} +
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
diff --git a/README.rst b/README.rst
index 3d2d165..88667ef 100644
--- a/README.rst
+++ b/README.rst
@@ -69,7 +69,7 @@ Download and Install
.. __: https://github.com/bottlepy/bottle/raw/master/bottle.py
-Install the latest stable release with ``pip install bottle``, ``easy_install -U bottle`` or download `bottle.py`__ (unstable) into your project directory. There are no hard dependencies other than the Python standard library. Bottle runs with **Python 2.7 and 3.3+**.
+Install the latest stable release with ``pip install bottle`` or download `bottle.py`__ (unstable) into your project directory. There are no hard dependencies other than the Python standard library. Bottle runs with **Python 2.7 and 3.3+**.
License
diff --git a/circle.yml b/circle.yml
index fb87243..45b6dfd 100644
--- a/circle.yml
+++ b/circle.yml
@@ -1,13 +1,13 @@
test:
override:
- pyenv versions
- - pyenv shell 2.7.3; eval "$(pyenv init -)"; python --version; python test/testall.py fast
- - pyenv shell 2.7; eval "$(pyenv init -)"; python --version; python test/testall.py fast
- - pyenv shell 3.3-dev; eval "$(pyenv init -)"; python --version; python test/testall.py fast
- - pyenv shell 3.4-dev; eval "$(pyenv init -)"; python --version; python test/testall.py fast
- - pyenv shell 3.5-dev; eval "$(pyenv init -)"; python --version; python test/testall.py fast
- - pyenv shell 3.6-dev; eval "$(pyenv init -)"; python --version; python test/testall.py fast
- - pyenv shell pypy-2.2; eval "$(pyenv init -)"; python --version; python test/testall.py fast
- - pyenv shell pypy-2.3; eval "$(pyenv init -)"; python --version; python test/testall.py fast
- - pyenv shell pypy-2.4; eval "$(pyenv init -)"; python --version; python test/testall.py fast
- - pyenv shell pypy-2.5; eval "$(pyenv init -)"; python --version; python test/testall.py fast
+ - pyenv shell 2.7.3; eval "$(pyenv init -)"; python --version; python -m unittest discover
+ - pyenv shell 2.7; eval "$(pyenv init -)"; python --version; python -m unittest discover
+ - pyenv shell 3.3-dev; eval "$(pyenv init -)"; python --version; python -m unittest discover
+ - pyenv shell 3.4-dev; eval "$(pyenv init -)"; python --version; python -m unittest discover
+ - pyenv shell 3.5-dev; eval "$(pyenv init -)"; python --version; python -m unittest discover
+ - pyenv shell 3.6-dev; eval "$(pyenv init -)"; python --version; python -m unittest discover
+ - pyenv shell pypy-2.2; eval "$(pyenv init -)"; python --version; python -m unittest discover
+ - pyenv shell pypy-2.3; eval "$(pyenv init -)"; python --version; python -m unittest discover
+ - pyenv shell pypy-2.4; eval "$(pyenv init -)"; python --version; python -m unittest discover
+ - pyenv shell pypy-2.5; eval "$(pyenv init -)"; python --version; python -m unittest discover
diff --git a/setup.cfg b/setup.cfg
index b8a1655..ed8a958 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,3 +1,5 @@
[bdist_wheel]
universal = 1
+[metadata]
+license_file = LICENSE
diff --git a/setup.py b/setup.py
index b2d94ce..bcedd9d 100755
--- a/setup.py
+++ b/setup.py
@@ -1,10 +1,7 @@
#!/usr/bin/env python
import sys
-try:
- from setuptools import setup
-except ImportError:
- from distutils.core import setup
+from setuptools import setup
if sys.version_info < (2, 7):
raise NotImplementedError("Sorry, you need at least Python 2.7 or Python 3.2+ to use bottle.")
@@ -15,6 +12,7 @@ setup(name='bottle',
version=bottle.__version__,
description='Fast and simple WSGI-framework for small web-applications.',
long_description=bottle.__doc__,
+ long_description_content_type="text/markdown",
author=bottle.__author__,
author_email='marc@gsites.de',
url='http://bottlepy.org/',
@@ -23,6 +21,7 @@ setup(name='bottle',
license='MIT',
platforms='any',
classifiers=['Development Status :: 4 - Beta',
+ "Operating System :: OS Independent",
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries',
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):
diff --git a/tox.ini b/tox.ini
index 5cea742..c795073 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,10 +1,10 @@
[tox]
-envlist = py27,py32,py33,py27-most
+envlist = py27,py33,py34,py35,py36,py27-most
[testenv]
deps=Mako
jinja2
-commands={envpython} test/testall.py
+commands={envpython} -m unittest discover
sitepackages=False
[testenv:py27-most]