Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss committed Nov 1, 2023
2 parents ae4d838 + 87ab359 commit 3af44cc
Show file tree
Hide file tree
Showing 18 changed files with 113 additions and 288 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", 3.11, 3.12, pypy3.9, pypy3.10]
python-version: [3.7, 3.8, 3.9, "3.10", 3.11, 3.12, pypy3.9, pypy3.10]

steps:
- uses: actions/checkout@v4
Expand All @@ -33,7 +33,7 @@ jobs:
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade setuptools wheel
python3 -m pip install --upgrade setuptools wheel setuptools_scm
python3 -m pip install sphinx
python3 -m pip install ".[test,twisted]"
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ AUTHORS
ChangeLog
.idea
.tox
testtools/_version.py
man/testtools.1
man
8 changes: 7 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ testtools NEWS

Changes and improvements to testtools_, grouped by release.

2.6.1
2.7.0
~~~~~

Improvements
Expand All @@ -15,6 +15,12 @@ Improvements
* Add typing in various modules (still lacking full coverage).
(Jelmer Vernooij)

* Drop the 'test' command for distutils. This has been
deprecated since 2.6.0. (Jelmer Vernooij)

* Drop support for Python 3.6.
(Jelmer Vernooij)

2.6.0
~~~~~

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ under the same license as Python, see LICENSE for details.
Supported platforms
-------------------

* Python 3.6+ or PyPy3
* Python 3.7+ or PyPy3

If you would like to use testtools for earlier Pythons, consult the compatibility docs:

Expand Down
39 changes: 0 additions & 39 deletions doc/for-test-authors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,43 +88,6 @@ of them will happily run testtools tests. In particular:

From now on, we'll assume that you know how to run your tests.

Running test with Distutils
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. deprecated:: 2.6.0

Distutils integration was deprecated in 2.6.0. You should consider
replacing invocations of ``python setup.py test`` with a suitable
alternative such as ``tox``. Refer to `this issue`__ for more information.

.. __: https://github.com/pypa/setuptools/issues/1684

If you are using Distutils_ to build your Python project, you can use the testtools
Distutils_ command to integrate testtools into your Distutils_ workflow::

from distutils.core import setup
from testtools import TestCommand
setup(name='foo',
version='1.0',
py_modules=['foo'],
cmdclass={'test': TestCommand}
)

You can then run::

$ python setup.py test -m exampletest
Tests running...
Ran 2 tests in 0.000s

OK

For more information about the capabilities of the `TestCommand` command see::

$ python setup.py test --help

You can use the `setup configuration`_ to specify the default behavior of the
`TestCommand` command.

Assertions
==========

Expand Down Expand Up @@ -1469,6 +1432,4 @@ Here, ``repr(nullary)`` will be the same as ``repr(f)``.
.. _doctest: http://docs.python.org/library/doctest.html
.. _Deferred: http://twistedmatrix.com/documents/current/core/howto/defer.html
.. _discover: http://pypi.python.org/pypi/discover
.. _Distutils: http://docs.python.org/library/distutils.html
.. _`setup configuration`: http://docs.python.org/distutils/configfile.html
.. _broken: http://chipaca.com/post/3210673069/hasattr-17-less-harmful
3 changes: 2 additions & 1 deletion doc/hacking.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Coding style
In general, follow `PEP 8`_ except where consistency with the standard
library's unittest_ module would suggest otherwise.

testtools supports Python 3.6 and later.
code should run on all supported Python versions; see the project configuration
for the current list.

Copyright assignment
--------------------
Expand Down
2 changes: 1 addition & 1 deletion doc/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Cross-Python compatibility
--------------------------

testtools gives you the very latest in unit testing technology in a way that
will work with Python 3.6+ and PyPy3.
will work with Python 3.7+ and PyPy3.

If you wish to use testtools with Python 2.4 or 2.5, then please use testtools
0.9.15.
Expand Down
70 changes: 69 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,74 @@ module = [
"fixtures.*",
"testresources.*",
"testscenarios.*",
"pbr.*",
]
ignore_missing_imports = true

[build-system]
requires = ["setuptools>=61"]
build-backend = "setuptools.build_meta"

[project]
name = "testtools"
description = "Extensions to the Python standard library unit testing framework"
readme = "doc/overview.rst"
authors = [{name = "Jonathan M. Lange", email = "jml+testtools@mumak.net"}]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Testing",
]
dependencies = ["setuptools; python_version>='3.12'"]
dynamic = ["version"]
requires-python = ">=3.7"

[project.urls]
Homepage = "https://github.com/testing-cabal/testtools"

[tool.setuptools]
include-package-data = false

[tool.setuptools.packages.find]
include = ["testtools"]
exclude = ["man*"]

[tool.extras]
test = """
testscenarios
testresources"""
twisted = """
Twisted"""

[tool.files]
packages = "testtools"

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "testtools/_version.py"
tag-pattern = "^(testtools-)?(?P<version>[0-9]+(\\.[0-9]+)*(-[0-9]+)?)(\\.post(?P<post>[0-9]+))?$"
template = """\
# This file is automatically generated by hatch.
version = {version!r}
__version__ = {version_tuple!r}
"""

[project.optional-dependencies]
test = ["testscenarios", "testresources"]
twisted = ["Twisted", "fixtures"]
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pbr>=0.11
fixtures>=2.0
2 changes: 1 addition & 1 deletion scripts/all-pythons
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ def now():
if __name__ == '__main__':
sys.path.append(ROOT)
result = TestProtocolClient(sys.stdout)
for version in '3.6 3.7 3.8 3.9 3.10 3.11'.split():
for version in '3.7 3.8 3.9 3.10 3.11 3.12'.split():
run_for_python(version, result, sys.argv[1:])
42 changes: 0 additions & 42 deletions setup.cfg

This file was deleted.

15 changes: 1 addition & 14 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
#!/usr/bin/env python
import setuptools

try:
import testtools
cmd_class = {}
if getattr(testtools, 'TestCommand', None) is not None:
cmd_class['test'] = testtools.TestCommand
except:
cmd_class = None


setuptools.setup(
python_requires='>=3.6',
cmdclass=cmd_class,
setup_requires=['pbr'],
pbr=True)
setuptools.setup()
27 changes: 21 additions & 6 deletions testtools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
'ResourcedToStreamDecorator',
'Tagger',
'TestCase',
'TestCommand',
'TestByTestResult',
'TestResult',
'TestResultDecorator',
Expand All @@ -43,6 +42,8 @@
'TimestampingStreamResult',
'try_import',
'unique_text_generator',
'version',
'__version__',
]

from testtools.helpers import try_import
Expand Down Expand Up @@ -96,7 +97,6 @@
FixtureSuite,
iterate_tests,
)
from testtools.distutilscmd import TestCommand

# same format as sys.version_info: "A tuple containing the five components of
# the version number: major, minor, micro, releaselevel, and serial. All
Expand All @@ -109,7 +109,22 @@
# 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).
from pbr.version import VersionInfo
_version = VersionInfo('testtools')
__version__ = _version.semantic_version().version_tuple()
version = _version.release_string()

try:
# If setuptools_scm is installed (e.g. in a development environment with
# an editable install), then use it to determine the version dynamically.
from setuptools_scm import get_version

# This will fail with LookupError if the package is not installed in
# editable mode or if Git is not installed.
version = get_version(root="..", relative_to=__file__)
__version__ = tuple(version.split('.'))
except (ImportError, LookupError):
# As a fallback, use the version that is hard-coded in the file.
try:
from ._version import (__version__, version)
except ModuleNotFoundError:
# The user is probably trying to run this without having installed
# the package, so complain.
raise RuntimeError(
"Testtools is not correctly installed. Please install it with pip.")

0 comments on commit 3af44cc

Please sign in to comment.