{"id":13501406,"url":"https://github.com/samuelcolvin/pytest-toolbox","last_synced_at":"2025-03-29T09:30:29.724Z","repository":{"id":51352929,"uuid":"75754485","full_name":"samuelcolvin/pytest-toolbox","owner":"samuelcolvin","description":"Numerous useful plugins for pytest.","archived":true,"fork":false,"pushed_at":"2022-09-27T12:23:41.000Z","size":36,"stargazers_count":7,"open_issues_count":10,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-05T14:59:54.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samuelcolvin.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-06T17:23:52.000Z","updated_at":"2023-01-27T20:47:57.000Z","dependencies_parsed_at":"2022-09-13T08:41:09.960Z","dependency_job_id":null,"html_url":"https://github.com/samuelcolvin/pytest-toolbox","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelcolvin%2Fpytest-toolbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelcolvin%2Fpytest-toolbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelcolvin%2Fpytest-toolbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelcolvin%2Fpytest-toolbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samuelcolvin","download_url":"https://codeload.github.com/samuelcolvin/pytest-toolbox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213424617,"owners_count":15585294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T22:01:36.265Z","updated_at":"2024-07-31T22:06:16.358Z","avatar_url":"https://github.com/samuelcolvin.png","language":"Python","readme":"pytest-toolbox\n==============\n\n**Note:** this repo is no-longer maintained, the best bits have been moved to https://github.com/samuelcolvin/dirty-equals\n\n|Build Status| |codecov.io| |PyPI Status| |license|\n\nCopyright (C) 2016 Samuel Colvin\n\nNumerous useful plugins for pytest.\n\nFixtures\n--------\n\n``tmpworkdir``\n    Run the test with the working directory set to a temporary directory. Similar to the pytest plugin ``tmpdir``\n    except working directory is changed.\n\n``smart_caplog``\n    capture logs with a smarter interface than pytest's native ``caplog``\n\n``print_logs``\n    print all logs.\n\n``loop``\n    asyncio loop.\n\nMethods\n-------\n\n(See below for usage examples).\n\n``mktree``\n    Create a tree of files from a dictionary.\n\n``gettree``\n    Return a dictionary depicting a directory tree.\n\n\nComparison Objects\n------------------\n\nAll can be imported from ``pytest_toolbox.comparison``.\n\n``CloseToNow``\n    check that a date (or date-like object) is close to now\n\n``AnyInt``\n    check tests that an object is an int\n\n``RegexStr``\n    check that a string matches the regex\n\n``IsUUID``\n    that that an object is an instance of ``UUID``.\n\nUsed with equals as in ``my_date == CloseToNow()``, these are useful when checking objects which contain\na few unknown values are as expected\n\nEg.\n\n.. code-block:: python\n\n   assert {\n       'details': {\n           'user': 'foobar@example.com',\n           'id': AnyInt(),\n           'published': False,\n           'event': 'an example',\n           'created_ts': CloseToNow(),\n       },\n       'other_thing': [\n           ...\n       ],\n       ...\n   } == obj\n\nUsage\n-----\n\n.. code:: python\n\n    from pytest_toolbox import gettree, mktree\n\n    def test_whatever(tmpworkdir):\n        mktree(tmpworkdir, {\n            'foobar.txt': 'has this content'\n        })\n        assert gettree(tmpworkdir) = {'foobar.txt': 'has this content'}\n\n**TODO**\n\n\n.. |Build Status| image:: https://travis-ci.org/samuelcolvin/pytest-toolbox.svg?branch=master\n   :target: https://travis-ci.org/samuelcolvin/pytest-toolbox\n.. |codecov.io| image:: http://codecov.io/github/samuelcolvin/pytest-toolbox/coverage.svg?branch=master\n   :target: http://codecov.io/github/samuelcolvin/pytest-toolbox?branch=master\n.. |PyPI Status| image:: https://img.shields.io/pypi/v/pytest-toolbox.svg?style=flat\n   :target: https://pypi.python.org/pypi/pytest-toolbox\n.. |license| image:: https://img.shields.io/pypi/l/pytest-toolbox.svg\n   :target: https://github.com/samuelcolvin/pytest-toolbox\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelcolvin%2Fpytest-toolbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamuelcolvin%2Fpytest-toolbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelcolvin%2Fpytest-toolbox/lists"}