diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a171683..1a2dc1b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -47,7 +47,7 @@ jobs: run: rst2html README.rst README.html if: matrix.python != '3.8' - name: Archive build results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4.6.0 with: name: html-docs-build path: README.html diff --git a/.gitignore b/.gitignore index 03ae26e..614b8e6 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,7 @@ fixtures.egg-info *.pyc .*.swp *~ -AUTHORS -ChangeLog .eggs build .tox +fixtures/_version.py diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..3bddae9 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,24 @@ +Andrew Laski +Balazs Gibizer +Brant Knudson +Clark Boylan +Dan Kenigsberg +Edward Betts +Francesco Banconi +Free Ekanayaka +Gabi Davar +Gavin Panella +Hugo +James Westby +Jelmer Vernooij +John L. Villalovos +Jonathan Lange +Joshua Harlow +Julien Danjou +Jürgen Gmach +Martin Pool +Robert Collins +Sean Dague +Stephen Finucane +Steve Kowalik +hugovk diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..c6fdc69 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,294 @@ +CHANGES +======= + +4.2.3 +----- +* Remove dependency of pbr and start using pyproject.toml for setuptools + +3.0.0 - 4.2.2 +------------- +* Remove six and other Python 2 handling code +* Drop support for Python < 3.6, add 3.7 - 3.9 +* Fix tests on Python 3.9 +* Remove use of 'extras' +* Drop support for EOL Python 2.6 and 3.3 +* Add possibility to reset the FakeLogger +* Drop support for EOL Python 3.3 +* Drop support for EOL Python 2.6 +* pick 8626952e Test ImageDraw2 Use latest PyPy3 +* Remove unused imports and variables +* Drop support for EOL Python 2.6 +* Correct spelling mistakes +* Update classifiers +* Add python 3.6 support (#36) +* Add missing APIs to FakeProcess, making it match Popen (LP #1373224) +* and many more which have not been properly tracked + +3.0.0 +----- + +* Release 3.0.0 +* Fixup the MonkeyPatch patch +* Tweak the new tests for consistency +* Update the semantics on \_fixtures.MonkeyPatch +* Avoid old versions of pbr - we require modern releases +* Correct MockPatchMultiple example +* Ignore .tox + +2.0.0 +----- + +* Fixup NEWS, release 2.0 +* MonkeyPatch staticmethod +* Drop support for Python 3.2. It's history +* Fix print in README +* Add CompoundFixture +* Tweak hacking docs +* Fix "propagate" spelling everywhere +* Missed one: propogate -> propagate +* Spelling and lint fixes + +1.4 +--- + +* Release 1.4 +* Trivial pep8 fix to logger.py +* FakeLogger: Mis-formatted log messages will raise Exception +* Use mock in preference to unittest.mock +* Add a .travis.yml +* Note how to push on releases + +1.3.1 +----- + +* Release 1.3.1 +* Clarify the intent around \_setUp +* Handle BaseException resource leaks as well + +1.3.0 +----- + +* Release 1.3.0 +* Remove trailing whitespace +* Deal with resource leaks during setUp +* Missed NEWS entry +* Fine tune the mock patch +* Add a new mockpatch fixture +* Document where the project home and source are +* Ignore built things + +1.2.0 +----- + +* Release 1.2.0 +* Add a warnings module capture fixure +* Use universal wheels + +1.1.0 +----- + +* Release 1.1.0 and use pbr 0.11 features +* Missing NEWS entry +* add tox.ini file +* Fixed test performance on Python 3.5 +* Add NEWS for FakeLogger formatter +* allow the specification of a custom log formatter + +1.0.0 +----- + +* Release 1.0.0 +* remote copy/paste from another project + +0.3.17 +------ + +* Release 0.3.17 +* Add support for datefmt in FakeLogger +* Migrate to git and pbr + +0.3.16 +------ + +* 0.3.16 ~~~~~~ + +0.3.15 +------ + +* Release 0.3.15 +* \* \`\`FakeProcess\`\` wait() now supports arguments added in Python 3. (Steve Kowalik) +* \* \`\`FakeProcess\`\` wait() now supports arguments added in Python 3. (Steve Kowalik) +* \* \`\`FakeProcess\`\` now supports kill(). (Steve Kowalik) +* \* \`\`FakePopen\`\` now supports being called under a context manager (IE: with). (Steve Kowalik) +* \* \`\`MonkeyPatch\`\` now preserves \`\`staticmethod\`\` functions. (Dan Kenigsberg) +* \* \`\`FakeProcess\`\` now supports kill(). (Steve Kowalik) +* \* \`\`FakePopen\`\` now works under a context manager itself. (Steve Kowalik, #1358085) +* MonkeyPatch staticmethod + +0.3.14 +------ + +* Release 0.3.14 +* \* \`\`FakePopen\`\` can now override the returncode attribute. (Robert Collins) +* More releasing docs + +0.3.13 +------ + +* Release 0.3.13 +* \* Documentation hopefully covers \`\`TestWithFixtures\`\` a little better. (Robert Collins, #1102688) +* Ignore an egg-info directory if it exists +* \* \`\`setup.py\`\` now lists the \`\`testtools\`\` dependency which was missing. (Robert Collins, #1103823) +* \* \`\`FakePopen\`\` now accepts all the parameters available in Python 2.7. (Robert Collins) + +0.3.12 +------ + +* 0.3.12: 0.3.11 with tests for StringStream +* Oops, setup.py wasn't 3.2 ready +* Add Python 3 Trove entry + +0.3.11 +------ + +* Release 0.3.11 +* \* pydoc is recommended as a source of info about fixtures. (Robert Collins, #812845) +* \* The docs for fixtures have been updated to cover the full API. (Robert Collins, #1071649) +* \* \`\`DetailStream\`\` was ambiguous about whether it handled bytes or characters, which matters a lot for Python3. It now is deprecated with ByteStream and StringStream replacing it. (Robert Collins) +* Update docs +* \* \`\`DetailStream\`\` was ambiguous about whether it handled bytes or characters, which matters a lot for Python3. It now is deprecated with ByteStream and StringStream replacing it. (Robert Collins) +* \* \`\`FakeLogger\`\` has been split out into a \`\`LogHandler\`\` fixture that can inject arbitrary handlers, giving more flexability. (Jonathan Lange) +* Drop the MementoHandler stuff +* Rest of the tests for LogHandler +* Give up on MementoHandler, just test LogHandler instead +* Change the MementoHandler to store a dict. Start testing the logger fixture +* Make handler public +* Extract the handler managing bit of FakeLogger into its own fixture +* Add MementoHandler +* Release 0.3.10 +* \* New \`\`DetailStream\`\` fixture to add file-like object content to testtools details. This allows for easy capture of sys.stdout and sys.stderr for example. (Clark Boylan) +* Document DetailStream +* \* New \`\`DetailStream\`\` fixture to add file-like object content to testtools details. This allows for easy capture of sys.stdout and sys.stderr for example. (Clark Boylan) +* \* Factor out new \`\`CallMany\`\` class to isolate the cleanup logic. (Robert Collins) +* Add 'join' method to TempDir +* Revert filetree patch, r54. Now in lp:treeshape +* Rename to 'join' +* Update NEWS +* Add an 'abspath' helper +* Roll back properly +* Remove filetree cruft +* Add facility to make a tree of files on a TempDir (r=lifeless) +* NEWS +* Change the API to have \*args +* Move filetree tests to be against tempdir +* Remove duplicate tests +* Remove filetree +* Remove FileTree +* Make FileTree a thing on tempdir +* Rename NoHasattr to HasNoAttribute +* Spell it more simply +* Heaps more docstrings +* Integration test +* Create parent directories +* Bump the testtools dependency +* Do stuff as late as possible +* Extract out another function +* Richer error messages +* Extract the bit that normalizes the entries +* Extract normalize\_shape +* Refactoring. Some comments in the tests +* Docs. Nicer directory specification +* Basic directory creation +* Start writing stuff to disk +* Initial creation of FileTree +* Add a matcher, because I can't bear to write that code again +* Clean up pyflakes +* Export TempHomeDir. Otherwise it's imported here for no reason + +0.3.9 +----- + +* Release 0.3.9 +* Include logging output in FakeLoggers' getDetails, surfacing the logs to testtools tests automatically +* Removed unused text\_content import +* Updated the way the detail name is added +* Fixes from review +* Implemented FakeLogger.getDetails() +* New TempHomeDir fixture to create and activate a temporary home dir (james\_w) +* Subclass TempDir rather than composing +* Fix the typo. Thanks Rob +* Remove the debugging echo +* Add a TempHomeDir fixture + +0.3.8 +----- + +* Release 0.3.8 +* MNerge NestedTempfile - make tempfile default to a new default location +* Rationalise fixture names. (Jonathan Lange) +* Fix race conditions in Timeout +* Update to parallel capable .testr.conf +* Reverse order of operands to assertNotEqual to follow conventions +* New fixture NestedTempfile +* Rename to just TimeoutException, and remove more connections to Timeout only being used in tests +* Rename to just 'Timeout'; other review cleanups +* Add TestTimeout fixture +* Correctly disambiguate duplicate errors +* Copyright +* PopenFixture => FakePopen +* Rename LoggerFixture to FakeLogger +* Rename EnvironmentVariableFixture to EnvironmentVariable +* Another typo +* EnvironmentVariableFixture now upcalls via super +* Add docs for LoggerFixture to README +* Fix typo +* Open up 0.3.8 +* Release 0.3.7 +* Add new LoggingFixture fixture for replacing logging Loggers +* Upcall w/ super() +* Nuke handlers by default +* Add LoggerFixture +* Upcall. Doh +* Bump version to 0.3.7 beta +* Typo +* Extend TempDir to allow controlling the root directory +* \* On Python 2.7 and above the \_fixtures tests are no longer run twice. (Robert Collins) +* Note in NEWS the new testtools version dependency as well +* NEWS & README +* Pretty sure this is a py3 thing +* Make the tests run with python 2 and 3 +* Update to take testtools new API into account +* Release 0.3.6 +* Another small API break - sorry. Fixture.getDetails no longer returns the internal details dict (self.\_details). Access that directly if needed. It now looks for details in used fixtures and returns those as well as details added directly. (RobertCollins, #780806) +* New fixture \`\`PackagePathEntry\`\` which patches the path of an existing package, allowing importing part of it from aonther directory. (Robert Collins) +* \* Details from child fixtures for both Fixture and TestWithFixtures no longer quash same-named details if testtools 0.9.11 is available (for the gather\_details helper). (Gavin Panella, #796253) +* Test failure on some setups in test\_cleanUp\_raise\_first\_false\_callscleanups\_returns\_exceptions. (Gavin Panella, #796249) +* Gather details from fixtures that fail to setUp() in TestWithFixtures +* Use testtools.helpers.try\_import instead of try:except: +* Skip test\_useFixture\_details\_captured\_from\_setUp if gather\_details is not available +* Reminder to self to skip test if gather\_details is not available +* Test against types.TracebackType instead of the type of the current traceback in sys.exc\_info() +* Gather details from fixtures that fail to setUp() +* \* New fixture \`\`PythonPathEntry\`\` which patches sys.path. (Robert Collins, #737503) +* Better docs for cleanUp and exceptions +* Document sharing dependencies somewhat +* Release 0.3.5 +* New fixture \`\`PythonPackage\`\` which manages a temporary python package. (Robert Collins) +* Add a TempDir fixture +* More docs +* New helper \`\`MonkeyPatch\`\` which patches (or deletes) an existing attribute and restores it afterwards. (Robert Collins) +* Release 0.3.4 +* Fixture now supports \`\`addDetail\`\` and provides a\`\`getDetails\`\` call compatible with the \`\`testtools.TestCase\`\` calls. (Robert Collins, #640119) +* Add MethodFixture for easier wrapping of existing fixture-like objects +* Fixtures now have a \`\`useFixture\`\` method as well, making nesting of fixtures trivial +* Add EnvironmentVariableFixture +* Ship new packages +* Release 0.3.1 +* Add a communicate method to FakeProcess +* \* Experimental PopenFixture providing a test double for testing code that runs external processes. (Robert Collins) +* Fixup cleanUp protocol for good +* Stop silently swallowing exceptions during cleanUp +* Cause cleanup failures to cause test failures +* Correct the example context manager in README, and provide a protocol for cleanUp to signal exceptions +* Document a shortcoming of using fixtures as context managers +* First draft - 0.1 diff --git a/fixtures/__init__.py b/fixtures/__init__.py index f78e113..748e3e9 100644 --- a/fixtures/__init__.py +++ b/fixtures/__init__.py @@ -25,23 +25,7 @@ Most users will want to look at TestWithFixtures and Fixture, to start with. """ -# same format as sys.version_info: "A tuple containing the five components of -# the version number: major, minor, micro, releaselevel, and serial. All -# values except releaselevel are integers; the release level is 'alpha', -# 'beta', 'candidate', or 'final'. The version_info value corresponding to the -# Python version 3.9 is (3, 9, 0, 'final', 0)." Additionally we use a -# releaselevel of 'dev' for unreleased under-development code. -# -# If the releaselevel is 'alpha' then the major/minor/micro components are not -# 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('fixtures') -__version__ = _version.semantic_version().version_tuple() -version = _version.release_string() - +from fixtures._version import __version__ __all__ = [ 'ByteStream', @@ -76,7 +60,6 @@ 'WarningsCapture', 'WarningsFilter', '__version__', - 'version', ] diff --git a/pyproject.toml b/pyproject.toml index 98f31a4..745a56a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,50 @@ [build-system] -requires = ["pbr>=5.7.0", "setuptools>=36.6.0"] -build-backend = "pbr.build" +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[project] +name = "fixtures" +description = "Fixtures, reusable state for writing clean tests and more." +readme = "README.rst" +classifiers = [ + "Development Status :: 6 - Mature", + "Intended Audience :: Developers", + "License :: OSI Approved :: BSD License", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "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.13", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Software Development :: Quality Assurance", + "Topic :: Software Development :: Testing", +] +authors = [{name = "Robert Collins", email = "robertc@robertcollins.net"}] +license = {text = "Apache-2.0 or BSD"} +requires-python = ">=3.8" +dynamic = ["version"] + +[project.urls] +Homepage = "https://github.com/testing-cabal/fixtures" +"Bug Tracker" = "https://github.com/testing-cabal/fixtures/issues" +"Source Code" = "https://github.com/testing-cabal/fixtures" + +[project.optional-dependencies] +"streams" = ["testools"] +"test" = ["testtools"] +"docs" = ["docutils"] + +[tool.hatch.version] +source = "vcs" + +[tool.hatch.build.hooks.vcs] +version-file = "fixtures/_version.py" + +[tool.hatch.build.targets.sdist] +include = ["fixtures*"] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 6f8e5fd..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -pbr>=5.7.0 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 67eabdb..0000000 --- a/setup.cfg +++ /dev/null @@ -1,40 +0,0 @@ -[metadata] -name = fixtures -summary = Fixtures, reusable state for writing clean tests and more. -description_file = - README.rst -description_content_type = text/x-rst; charset=UTF-8 -author = Robert Collins -author_email = robertc@robertcollins.net -url = https://github.com/testing-cabal/fixtures -python_requires = >=3.8 -classifiers = - Development Status :: 6 - Mature - Intended Audience :: Developers - License :: OSI Approved :: BSD License - License :: OSI Approved :: Apache Software License - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - 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.13 - Programming Language :: Python :: Implementation :: CPython - Programming Language :: Python :: Implementation :: PyPy - Topic :: Software Development :: Quality Assurance - Topic :: Software Development :: Testing - -[files] -packages = - fixtures - -[extras] -streams = - testtools -test = - testtools -docs = - docutils diff --git a/setup.py b/setup.py deleted file mode 100755 index 4d65eee..0000000 --- a/setup.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env python - -import setuptools - -setuptools.setup( - setup_requires=['pbr>5.7.0'], - pbr=True, -)