{"id":13937571,"url":"https://github.com/benjamin-hodgson/Contexts","last_synced_at":"2025-07-19T23:33:05.930Z","repository":{"id":10926153,"uuid":"13228830","full_name":"benjamin-hodgson/Contexts","owner":"benjamin-hodgson","description":"Descriptive testing for Python","archived":true,"fork":false,"pushed_at":"2022-06-30T20:52:53.000Z","size":979,"stargazers_count":54,"open_issues_count":5,"forks_count":6,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-31T06:49:41.583Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/benjamin-hodgson.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-30T22:15:19.000Z","updated_at":"2024-08-09T23:05:42.000Z","dependencies_parsed_at":"2022-09-19T02:01:39.703Z","dependency_job_id":null,"html_url":"https://github.com/benjamin-hodgson/Contexts","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjamin-hodgson%2FContexts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjamin-hodgson%2FContexts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjamin-hodgson%2FContexts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjamin-hodgson%2FContexts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benjamin-hodgson","download_url":"https://codeload.github.com/benjamin-hodgson/Contexts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226700610,"owners_count":17668678,"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-08-07T23:03:41.523Z","updated_at":"2024-11-27T06:30:32.291Z","avatar_url":"https://github.com/benjamin-hodgson.png","language":"Python","funding_links":[],"categories":["资源列表","Testing","Python"],"sub_categories":["测试"],"readme":"I'm not maintaining this. You're welcome to fork it.\n====================================================\n\n\nContexts\n========\n[![Build Status](https://travis-ci.org/benjamin-hodgson/Contexts.png?branch=master)](https://travis-ci.org/benjamin-hodgson/Contexts)\n[![Documentation Status](https://readthedocs.org/projects/contexts/badge/?version=v0.11.2)](https://readthedocs.org/projects/contexts/?badge=v0.11.2)\n[![Coverage Status](https://coveralls.io/repos/benjamin-hodgson/Contexts/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/benjamin-hodgson/Contexts?branch=master)\n[![Requirements Status](https://requires.io/github/benjamin-hodgson/Contexts/requirements.svg?branch=master)](https://requires.io/github/benjamin-hodgson/Contexts/requirements/?branch=master)\n\nDead simple _descriptive testing_ for Python. No custom decorators, no context managers,\nno `.feature` files, no fuss.\n\n-----------------------------\n\nContexts is a 'Context-Specification'-style test framework for Python 3.3 and above, inspired by C#'s\n[`Machine.Specifications`](https://github.com/machine/machine.specifications).\nIt aims to be flexible and extensible, and is appropriate for unit, integration and acceptance testing. Read more at the [Huddle Dev Blog](http://tldr.huddle.com/blog/Write-Your-Tests-In-Another-Language/).\n\nTest written with Contexts resemble the grammar of ['Given/When/Then'](http://martinfowler.com/bliki/GivenWhenThen.html)-style\nspecifications. Writing tests which read like user-centric sentences can encourage you to\nfocus on the behaviour, not the implementation, of your code.\nContexts takes cues from [Behaviour Driven Development](http://dannorth.net/introducing-bdd/),\nbut it aims to be useful for more than just acceptance testing (unlike Cucumber or FitNesse).\n\nCool features\n-------------\n* Give your tests [**descriptive names**](http://contexts.readthedocs.org/en/latest/guide.html#defining-tests)\n  so you can tell what's gone wrong when they fail!\n* Run **all the assertions** for each test case, even when one fails!\n* Practice 'Example-Driven-Development' with [**parametrised tests**](http://contexts.readthedocs.org/en/latest/guide.html#examples-triangulating)!\n* Extend Contexts by writing your own [**plugins**](http://contexts.readthedocs.org/en/latest/plugins.html)!\n* Use the `assert` statement and still get [**helpful failure messages**](http://contexts.readthedocs.org/en/latest/guide.html#should-assertions)!\n* **Test all the things**!\n\nInstallation\n------------\nContexts is on [the Cheese Shop](https://pypi.python.org/pypi/Contexts), so you can install it the easy way:\n```\npip install contexts\n```\n\nIf you want the bleeding-edge version, you can install it the geeky way:\n```\ngit clone https://github.com/benjamin-hodgson/Contexts.git\ncd Contexts\npython setup.py install\n```\n\nContexts has no compulsory external dependencies. There is an optional dependency -\nif you like red and green colours in the output from your test runner\n(and who doesn't!), you need to install [Colorama](https://pypi.python.org/pypi/colorama).\n\nQuick start\n-----------\nHere's an example of a test case that the authors of [Requests](https://github.com/kennethreitz/requests)\nmight have written, if they were using Contexts.\nSee the [documentation](http://contexts.readthedocs.org/en/latest)\nfor [details](http://contexts.readthedocs.org/en/latest/guide.html)\nand [more examples](http://contexts.readthedocs.org/en/latest/samples.html).\n\n```python\nimport requests\n# no need to import contexts!\n\nclass WhenRequestingAResourceThatDoesNotExist:\n    def given_that_we_are_asking_for_a_made_up_resource(self):\n        self.uri = \"http://www.github.com/itdontexistman\"\n        self.session = requests.Session()\n\n    def because_we_make_a_request(self):\n        self.response = self.session.get(self.uri)\n\n    def the_response_should_have_a_status_code_of_404(self):\n        assert self.response.status_code == 404\n\n    def the_response_should_have_an_HTML_content_type(self):\n        assert self.response.headers['content-type'] == 'text/html'\n\n    def cleanup_the_session(self):\n        self.session.close()\n```\n\n### Running your tests\nType `run-contexts` at the command line to discover and run test files and folders in your working directory.\n\nHelp\n----\nAll the documentation is stored [on readthedocs](http://contexts.readthedocs.org/en/latest/index.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjamin-hodgson%2FContexts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenjamin-hodgson%2FContexts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjamin-hodgson%2FContexts/lists"}