{"id":25705609,"url":"https://github.com/salmonmode/contextional","last_synced_at":"2025-07-12T03:10:01.142Z","repository":{"id":62564605,"uuid":"82314544","full_name":"SalmonMode/contextional","owner":"SalmonMode","description":"A functional testing tool for Python","archived":false,"fork":false,"pushed_at":"2017-11-28T23:29:17.000Z","size":149,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T01:33:48.239Z","etag":null,"topics":["functional-testing","python","test","test-automation","testing","testing-tools","tests"],"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/SalmonMode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-02-17T16:13:00.000Z","updated_at":"2019-10-04T07:59:06.000Z","dependencies_parsed_at":"2022-11-03T16:45:39.188Z","dependency_job_id":null,"html_url":"https://github.com/SalmonMode/contextional","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SalmonMode%2Fcontextional","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SalmonMode%2Fcontextional/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SalmonMode%2Fcontextional/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SalmonMode%2Fcontextional/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SalmonMode","download_url":"https://codeload.github.com/SalmonMode/contextional/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240619425,"owners_count":19830204,"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":["functional-testing","python","test","test-automation","testing","testing-tools","tests"],"created_at":"2025-02-25T06:48:00.321Z","updated_at":"2025-02-25T06:48:00.971Z","avatar_url":"https://github.com/SalmonMode.png","language":"Python","readme":"[![Build status][bs-img]][bs-link]\n[![PyPI version][ppv-img]][ppv-link]\n[![Docs][docs-img]][docs-link]\n\n# Contextional\nA context-based functional testing tool for Python\n\n## Installation\n\nTo install it, just run:\n\n```shell\npip install contextional\n```\n\n## \"contex-tional?\"\n\nIt's a portmanteau of the words \"context\" and \"functional\". These words were chosen because the tool works by using context managers (`with` statements), and allows you to write functional tests (testing as you go).\n\n## What does it do?\n\nContextional does 3 things:\n\n1. It gives you more organized test output by breaking tests into a hierarchical structure based on how the tests were defined, letting you provide descriptive names for each layer of the hierarchy as well as the tests themselves.\n2. It lets you predefine a hierarchy of tests that can be easily reused in as many places as you'd like.\n3. It allows you to control the exact order in which your tests and fixtures occur, which can be extremely useful for writing comprehensive, functional test suites where you need to test as you go.\n\n## What does it look like?\n\n### code:\n\n```python\nfrom contextional import GCM\n\n\nwith GCM(\"Predefined Group\") as PG:\n\n    @GCM.add_test(\"value is still 2\")\n    def test(case):\n        case.assertEqual(\n            GCM.value,\n            2,\n        )\n\n\nwith GCM(\"Main Group\") as MG:\n\n    @GCM.add_setup\n    def setUp():\n        GCM.value = 0\n\n    @GCM.add_test_setup\n    def testSetUp():\n        GCM.value += 1\n\n    @GCM.add_test(\"value is 1\")\n    def test(case):\n        case.assertEqual(\n            GCM.value,\n            1,\n        )\n\n    @GCM.add_test(\"value is 2\")\n    def test():\n        assert GCM.value == 2\n\n    with GCM.add_group(\"Child Group\"):\n\n        @GCM.add_setup\n        def setUp():\n            GCM.value += 1\n\n        @GCM.add_test(\"value is now 3\")\n        def test():\n            assert GCM.value == 3\n\n        @GCM.add_teardown\n        def tearDown():\n            GCM.value -= 1\n\n    GCM.includes(PG)\n\n\nMG.create_tests()\n```\n\n### output\n\n```\nMain Group\n  value is 1 ... ok\n  value is 2 ... ok\n  Child Group\n    value is now 3 ... ok\n  Predefined Group\n    value is still 2 ... ok\n\n----------------------------------------------------------------------\nRan 4 tests in 0.008s\n\nOK\n```\n\n[bs-img]: https://travis-ci.org/SalmonMode/contextional.svg?branch=master\n[bs-link]: https://travis-ci.org/SalmonMode/contextional\n[ppv-img]: https://badge.fury.io/py/contextional.svg\n[ppv-link]: https://badge.fury.io/py/contextional\n[docs-img]: https://readthedocs.org/projects/pip/badge/\n[docs-link]: http://contextional.readthedocs.io/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalmonmode%2Fcontextional","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalmonmode%2Fcontextional","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalmonmode%2Fcontextional/lists"}