Permalink
...
Comparing changes
Open a pull request
3
contributors
Unified
Split
Showing
with
475 additions
and 720 deletions.
- +3 −0 .gitignore
- +7 −3 .travis.yml
- +0 −3 MANIFEST.in
- +72 −0 NEWS
- +7 −0 doc/for-framework-folk.rst
- +3 −1 doc/for-test-authors.rst
- +1 −5 doc/hacking.rst
- +7 −0 requirements.txt
- +13 −4 setup.cfg
- +12 −88 setup.py
- +4 −2 testtools/__init__.py
- +4 −165 testtools/compat.py
- +52 −65 testtools/content.py
- +2 −6 testtools/deferredruntest.py
- +34 −14 testtools/run.py
- +2 −0 testtools/runtest.py
- +6 −2 testtools/testcase.py
- +25 −10 testtools/testresult/real.py
- +1 −306 testtools/tests/test_compat.py
- +0 −4 testtools/tests/test_content.py
- +74 −18 testtools/tests/test_deferredruntest.py
- +52 −5 testtools/tests/test_run.py
- +75 −15 testtools/tests/test_testresult.py
- +17 −2 testtools/tests/test_testsuite.py
- +2 −2 testtools/testsuite.py
View
3
.gitignore
| @@ -16,3 +16,6 @@ doc/_build | ||
| testtools.egg-info | ||
| /build/ | ||
| /.env/ | ||
| +/.eggs/ | ||
| +AUTHORS | ||
| +ChangeLog | ||
View
10
.travis.yml
| @@ -6,20 +6,24 @@ python: | ||
| - "3.3" | ||
| - "3.4" | ||
| - "pypy" | ||
| - - "pypy3" | ||
| # We have to pin Jinja2 < 2.7 for Python 3.2 because 2.7 drops/breaks support: | ||
| # http://jinja.pocoo.org/docs/changelog/#version-2-7 | ||
| +# And Spinx to < 1.3 for pypy3 and python 3.2 similarly. | ||
| # | ||
| # See also: | ||
| # http://stackoverflow.com/questions/18252804/syntax-error-in-jinja-2-library | ||
| matrix: | ||
| include: | ||
| - python: "3.2" | ||
| - env: JINJA_REQ="jinja2<2.7, Pygments<2.0" | ||
| + env: | ||
| + - JINJA_REQ="jinja2<2.7, Pygments<2.0" | ||
| + - SPHINX="<1.3" | ||
| + - python: "pypy3" | ||
| + env: SPHINX="<1.3" | ||
| install: | ||
| - - pip install fixtures $JINJA_REQ sphinx | ||
| + - pip install fixtures $JINJA_REQ sphinx$SPHINX | ||
| - python setup.py install | ||
| script: | ||
View
3
MANIFEST.in
| @@ -4,7 +4,4 @@ include MANIFEST.in | ||
| include NEWS | ||
| include README.rst | ||
| include .gitignore | ||
| -graft doc | ||
| -graft doc/_static | ||
| -graft doc/_templates | ||
| prune doc/_build | ||
View
72
NEWS
| @@ -7,6 +7,78 @@ Changes and improvements to testtools_, grouped by release. | ||
| NEXT | ||
| ~~~~ | ||
| +1.8.0 | ||
| +~~~~~ | ||
| + | ||
| +Improvements | ||
| +------------ | ||
| + | ||
| +* AsynchronousDeferredRunTest now correctly attaches the test log. | ||
| + Previously it attached an empty file. (Colin Watson) | ||
| + | ||
| +1.7.1 | ||
| +~~~~~ | ||
| + | ||
| +Improvements | ||
| +------------ | ||
| + | ||
| +* Building a wheel on Python 3 was missing ``_compat2x.py`` needed for Python2. | ||
| + This was a side effect of the fix to bug #941958, where we fixed a cosmetic | ||
| + error. (Robert Collins, #1430534) | ||
| + | ||
| +* During reporting in ``TextTestResult`` now always uses ``ceil`` rather than | ||
| + depending on the undefined rounding behaviour in string formatting. | ||
| + (Robert Collins) | ||
| + | ||
| +1.7.0 | ||
| +~~~~~ | ||
| + | ||
| +Improvements | ||
| +------------ | ||
| + | ||
| +* Empty attachments to tests were triggering a file payload of None in the | ||
| + ``ExtendedToStreamDecorator`` code, which caused multiple copies of | ||
| + attachments that had been output prior to the empty one. | ||
| + (Robert Collins, #1378609) | ||
| + | ||
| +1.6.1 | ||
| +~~~~~ | ||
| + | ||
| +Changes | ||
| +------- | ||
| + | ||
| +* Fix installing when ``extras`` is not already installed. Our guards | ||
| + for the absence of unittest2 were not sufficient. | ||
| + (Robert Collins, #1430076) | ||
| + | ||
| +1.6.0 | ||
| +~~~~~ | ||
| + | ||
| +Improvements | ||
| +------------ | ||
| + | ||
| +* ``testtools.run`` now accepts ``--locals`` to show local variables | ||
| + in tracebacks, which can be a significant aid in debugging. In doing | ||
| + so we've removed the code reimplementing linecache and traceback by | ||
| + using the new traceback2 and linecache2 packages. | ||
| + (Robert Collins, github #111) | ||
| + | ||
| +Changes | ||
| +------- | ||
| + | ||
| +* ``testtools`` now depends on ``unittest2`` 1.0.0 which brings in a dependency | ||
| + on ``traceback2`` and via it ``linecache2``. (Robert Collins) | ||
| + | ||
| +1.5.0 | ||
| +~~~~~ | ||
| + | ||
| +Improvements | ||
| +------------ | ||
| + | ||
| +* When an import error happens ``testtools.run`` will now show the full | ||
| + error rather than just the name of the module that failed to import. | ||
| + (Robert Collins) | ||
| + | ||
| 1.4.0 | ||
| ~~~~~ | ||
View
7
doc/for-framework-folk.rst
| @@ -92,6 +92,13 @@ cause ``testtools.RunTest`` to fail the test case after the test has finished. | ||
| This is useful when you want to cause a test to fail, but don't want to | ||
| prevent the remainder of the test code from being executed. | ||
| +Exception formatting | ||
| +-------------------- | ||
| + | ||
| +Testtools ``TestCase`` instances format their own exceptions. The attribute | ||
| +``__testtools_tb_locals__`` controls whether to include local variables in the | ||
| +formatted exceptions. | ||
| + | ||
| Test placeholders | ||
| ================= | ||
View
4
doc/for-test-authors.rst
| @@ -72,10 +72,12 @@ installed or have Python 2.7 or later, and then run:: | ||
| $ python -m testtools.run discover packagecontainingtests | ||
| -For more information see the Python 2.7 unittest documentation, or:: | ||
| +For more information see the Python unittest documentation, and:: | ||
| python -m testtools.run --help | ||
| +which describes the options available to ``testtools.run``. | ||
| + | ||
| As your testing needs grow and evolve, you will probably want to use a more | ||
| sophisticated test runner. There are many of these for Python, and almost all | ||
| of them will happily run testtools tests. In particular: | ||
View
6
doc/hacking.rst
| @@ -169,20 +169,16 @@ Tasks | ||
| +++++ | ||
| #. Choose a version number, say X.Y.Z | ||
| -#. In trunk, ensure __init__ has version ``(X, Y, Z, 'final', 0)`` | ||
| #. Under NEXT in NEWS add a heading with the version number X.Y.Z. | ||
| #. Possibly write a blurb into NEWS. | ||
| #. Commit the changes. | ||
| -#. Tag the release, ``git tag -s testtools-X.Y.Z`` | ||
| +#. Tag the release, ``git tag -s X.Y.Z -m "Releasing X.Y.Z"`` | ||
| #. Run 'make release', this: | ||
| #. Creates a source distribution and uploads to PyPI | ||
| #. Ensures all Fix Committed bugs are in the release milestone | ||
| #. Makes a release on Launchpad and uploads the tarball | ||
| #. Marks all the Fix Committed bugs as Fix Released | ||
| #. Creates a new milestone | ||
| -#. Change __version__ in __init__.py to the probable next version. | ||
| - e.g. to ``(X, Y, Z+1, 'dev', 0)``. | ||
| -#. Commit 'Opening X.Y.Z+1 for development.' | ||
| #. If a new series has been created (e.g. 0.10.0), make the series on Launchpad. | ||
| #. Push trunk to Github, ``git push --tags origin master`` | ||
View
7
requirements.txt
| @@ -0,0 +1,7 @@ | ||
| +pbr>=0.11 | ||
| +extras | ||
| +# 'mimeparse' has not been uploaded by the maintainer with Python3 compat | ||
| +# but someone kindly uploaded a fixed version as 'python-mimeparse'. | ||
| +python-mimeparse | ||
| +unittest2>=1.0.0 | ||
| +traceback2 |
View
17
setup.cfg
| @@ -1,7 +1,16 @@ | ||
| -[test] | ||
| -test_module = testtools.tests | ||
| -buffer=1 | ||
| -catch=1 | ||
| +[metadata] | ||
| +name = testtools | ||
| +summary = Extensions to the Python standard library unit testing framework | ||
| +home-page = https://github.com/testing-cabal/testtools | ||
| +description-file = doc/overview.rst | ||
| +author = Jonathan M. Lange | ||
| +author-email = jml+testtools@mumak.net | ||
| +classifier = | ||
| + License :: OSI Approved :: MIT License | ||
| + Programming Language :: Python :: 3 | ||
| + | ||
| +[files] | ||
| +packages = testtools | ||
| [bdist_wheel] | ||
| universal = 1 |
View
100
setup.py
| @@ -1,92 +1,16 @@ | ||
| #!/usr/bin/env python | ||
| -"""Distutils installer for testtools.""" | ||
| +import setuptools | ||
| -from setuptools import setup | ||
| -from distutils.command.build_py import build_py | ||
| -import email | ||
| -import os | ||
| -import sys | ||
| +try: | ||
| + import testtools | ||
| + cmd_class = {} | ||
| + if getattr(testtools, 'TestCommand', None) is not None: | ||
| + cmd_class['test'] = testtools.TestCommand | ||
| +except: | ||
| + cmd_class = None | ||
| -import testtools | ||
| -cmd_class = {} | ||
| -if getattr(testtools, 'TestCommand', None) is not None: | ||
| - cmd_class['test'] = testtools.TestCommand | ||
| - | ||
| -class testtools_build_py(build_py): | ||
| - def build_module(self, module, module_file, package): | ||
| - if sys.version_info >= (3,) and module == '_compat2x': | ||
| - return | ||
| - return build_py.build_module(self, module, module_file, package) | ||
| -cmd_class['build_py'] = testtools_build_py | ||
| - | ||
| - | ||
| -def get_version_from_pkg_info(): | ||
| - """Get the version from PKG-INFO file if we can.""" | ||
| - pkg_info_path = os.path.join(os.path.dirname(__file__), 'PKG-INFO') | ||
| - try: | ||
| - pkg_info_file = open(pkg_info_path, 'r') | ||
| - except (IOError, OSError): | ||
| - return None | ||
| - try: | ||
| - pkg_info = email.message_from_file(pkg_info_file) | ||
| - except email.MessageError: | ||
| - return None | ||
| - return pkg_info.get('Version', None) | ||
| - | ||
| - | ||
| -def get_version(): | ||
| - """Return the version of testtools that we are building.""" | ||
| - version = '.'.join( | ||
| - str(component) for component in testtools.__version__[0:3]) | ||
| - phase = testtools.__version__[3] | ||
| - if phase == 'final': | ||
| - return version | ||
| - pkg_info_version = get_version_from_pkg_info() | ||
| - if pkg_info_version: | ||
| - return pkg_info_version | ||
| - # Apparently if we just say "snapshot" then distribute won't accept it | ||
| - # as satisfying versioned dependencies. This is a problem for the | ||
| - # daily build version. | ||
| - return "%s.0dev0" % (version,) | ||
| - | ||
| - | ||
| -def get_long_description(): | ||
| - manual_path = os.path.join( | ||
| - os.path.dirname(__file__), 'doc/overview.rst') | ||
| - return open(manual_path).read() | ||
| - | ||
| -# Since we import testtools in setup.py, our setup requirements are our install | ||
| -# requirements. | ||
| -deps = [ | ||
| - 'extras', | ||
| - # 'mimeparse' has not been uploaded by the maintainer with Python3 compat | ||
| - # but someone kindly uploaded a fixed version as 'python-mimeparse'. | ||
| - 'python-mimeparse', | ||
| - 'unittest2>=0.8.0', | ||
| - ] | ||
| - | ||
| - | ||
| -setup(name='testtools', | ||
| - author='Jonathan M. Lange', | ||
| - author_email='jml+testtools@mumak.net', | ||
| - url='https://github.com/testing-cabal/testtools', | ||
| - description=('Extensions to the Python standard library unit testing ' | ||
| - 'framework'), | ||
| - long_description=get_long_description(), | ||
| - version=get_version(), | ||
| - classifiers=["License :: OSI Approved :: MIT License", | ||
| - "Programming Language :: Python :: 3", | ||
| - ], | ||
| - packages=[ | ||
| - 'testtools', | ||
| - 'testtools.matchers', | ||
| - 'testtools.testresult', | ||
| - 'testtools.tests', | ||
| - 'testtools.tests.matchers', | ||
| - ], | ||
| - cmdclass=cmd_class, | ||
| - zip_safe=False, | ||
| - install_requires=deps, | ||
| - setup_requires=deps, | ||
| - ) | ||
| +setuptools.setup( | ||
| + cmdclass=cmd_class, | ||
| + setup_requires=['pbr'], | ||
| + pbr=True) |
View
6
testtools/__init__.py
| @@ -121,5 +121,7 @@ | ||
| # established at this point, and setup.py will use a version of next-$(revno). | ||
| # If the releaselevel is 'final', then the tarball will be major.minor.micro. | ||
| # Otherwise it is major.minor.micro~$(revno). | ||
| - | ||
| -__version__ = (1, 4, 0, 'final', 0) | ||
| +from pbr.version import VersionInfo | ||
| +_version = VersionInfo('testtools') | ||
| +__version__ = _version.semantic_version().version_tuple() | ||
| +version = _version.release_string() | ||
Oops, something went wrong.