{"id":18657693,"url":"https://github.com/cle-b/lymbo","last_synced_at":"2026-03-05T09:01:34.632Z","repository":{"id":257780808,"uuid":"831860047","full_name":"cle-b/lymbo","owner":"cle-b","description":"A test runner designed for large test suites and small scripts.","archived":false,"fork":false,"pushed_at":"2025-05-30T17:24:44.000Z","size":79,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-20T08:24:00.090Z","etag":null,"topics":["test","testing","tests"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cle-b.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-21T20:25:10.000Z","updated_at":"2025-05-30T17:24:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"64b02a78-124b-44b7-96e1-ee23181b9033","html_url":"https://github.com/cle-b/lymbo","commit_stats":null,"previous_names":["cle-b/lymbo"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/cle-b/lymbo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cle-b%2Flymbo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cle-b%2Flymbo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cle-b%2Flymbo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cle-b%2Flymbo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cle-b","download_url":"https://codeload.github.com/cle-b/lymbo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cle-b%2Flymbo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30069242,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T01:03:42.280Z","status":"online","status_checked_at":"2026-03-04T02:00:07.464Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["test","testing","tests"],"created_at":"2024-11-07T07:29:35.725Z","updated_at":"2026-03-05T09:01:34.048Z","avatar_url":"https://github.com/cle-b.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lymbo\n\n* **lymbo** is a test runner designed for large test suites and small scripts.\n\nThe key features of **lymbo** are:\n\n  * Parallel execution by default\n  * Simplicity\n  * No dependencies\n\n\n## Concetps\n\nIn **lymbo**, there are only two key concepts to understand: `test` and `resource`.\n\n### Test\n\nTo define a test, simply decorate a function or a method using `lymbo.test()`:\n\n```python\nimport lymbo\n\n@lymbo.test()\ndef addition():\n    assert 1 + 2 == 3, \"Addition test failed: 1 + 2 did not equal 3\"\n```\n\nYou can run the test using the command `lymbo`:\n\n```\n(venv) ~/dev/lymbo$ lymbo examples/ \n** lymbo 0.2.0 (python 3.9.18) (Linux-5.15.0-122-generic-x86_64-with-glibc2.35) **\n==== collecting tests\n==== 1 test in 1 group\n==== running tests\n.P\n==== tests executed in 0 second\n==== results\n- examples/readme.py::addition() [PASSED]\n==== 1 passed \n```\n\nA test is parameterizable:\n\n```python\nimport math\n\nimport lymbo\nfrom lymbo import args, expand\n\n@lymbo.test(args(n=expand(1, 4, 9, 116)))\ndef is_perfect_square(n):\n    assert int(math.sqrt(n)) ** 2 == n, f\"Assertion failed: {n} is not a perfect square. Its square root is {math.sqrt(n)}.\"\n```\n\nYou can run only these new tests using the `filter` option:\n\n```\n(venv) ~/dev/lymbo$ lymbo examples/ --filter=square\n** lymbo 0.2.0 (python 3.9.18) (Linux-5.15.0-122-generic-x86_64-with-glibc2.35) **\n==== collecting tests\n==== 4 tests in 4 groups\n==== running tests\n.P.P.P.F\n==== tests executed in 1 second\n==== results\n- examples/readme.py::is_perfect_square(n=1) [PASSED]\n- examples/readme.py::is_perfect_square(n=4) [PASSED]\n- examples/readme.py::is_perfect_square(n=9) [PASSED]\n- examples/readme.py::is_perfect_square(n=116) [FAILED]\n==== 3 passed 1 failed  \n==== failures\nexamples/readme.py::is_perfect_square(n=116)\n - - - - reason:\n  Assertion failed: 116 is not a perfect square. Its square root is 10.770329614269007.\n  ---------------------\n  AssertionError in /home/cle/dev/lymbo/examples/readme.py, line 14, in is_perfect_square:\n      12: @lymbo.test(args(n=expand(1, 4, 9, 116)))\n      13: def is_perfect_square(n):\n  ==\u003e 14:     assert (\n      15:         int(math.sqrt(n)) ** 2 == n\n      16:     ), f\"Assertion failed: {n} is not a perfect square. Its square root is {math.sqrt(n)}.\"\n====\n```\n\nIn the example above, the tests were executed independently. As a result, they may have been run in parallel by multiple workers.\n\nWe can group the tests to ensure they run sequentially on the same worker. In the example below, we will group the tests by function and execute a test collection to print the test plan:\n\n```\n(venv) ~/dev/lymbo$ lymbo examples/ --groupby=function --collect\n** lymbo 0.2.0 (python 3.9.18) (Linux-5.15.0-122-generic-x86_64-with-glibc2.35) **\n==== collecting tests\n- examples/readme.py::addition()\n+ 4 tests grouped by examples/readme.py::None::is_perfect_square\n  | - examples/readme.py::is_perfect_square(n=1)\n  | - examples/readme.py::is_perfect_square(n=4)\n  | - examples/readme.py::is_perfect_square(n=9)\n  | - examples/readme.py::is_perfect_square(n=116)\n==== 5 tests in 2 groups\n``` \n\nFor a very simple unit test, you can decorate the function you want to test and verify the returned value to assert the test outcome.\n\n```python\n@lymbo.test(args(a=4, b=2), expected(2))\n@lymbo.test(args(a=9, b=2), expected=expected(4.5))\n@lymbo.test(args(a=9, b=0), expected=expected(ZeroDivisionError))\ndef division(a, b):\n    return a / b\n```\n\n```\n(venv) ~/dev/lymbo$ lymbo examples/readme.py --filter=division\n** lymbo 0.3.0 (python 3.9.18) (Linux-5.15.0-122-generic-x86_64-with-glibc2.35) **\n==== collecting tests\n==== 3 tests in 3 groups\n==== running tests\n.P.P.P\n==== tests executed in 0 second\n==== results\n- examples/readme.py::division(a=4,b=2)-\u003e(value=2) [PASSED]\n- examples/readme.py::division(a=9,b=2)-\u003e(value=4.5) [PASSED]\n- examples/readme.py::division(a=9,b=0)-\u003e(value=ZeroDivisionError) [PASSED]\n==== 3 passed \n```\n\n### Resource\n\nA resource is a standard context manager.\n\nIn the example below, we will execute 3 tests using 2 workers. Each test will use a resource that takes 5 seconds.\n\n```python\nimport contextlib\nimport time\n\nimport lymbo\n\n\n@contextlib.contextmanager\ndef wait_five_seconds():\n    time.sleep(5)\n    yield\n\n\n@lymbo.test()\ndef demo_resource_no_scope_first_test():\n    with wait_five_seconds():\n        assert True\n\n\n@lymbo.test()\ndef demo_resource_no_scope_second_test():\n    with wait_five_seconds():\n        assert True\n\n\n@lymbo.test()\ndef demo_resource_no_scope_third_test():\n    with wait_five_seconds():\n        assert True\n```\n\nThe tests will be executed in 10 seconds because the resource (which takes 5 seconds) is not shared between tests.\n\n```\n(venv) ~/dev/lymbo$ lymbo examples/ --filter=resource_no_scope --workers=2\n** lymbo 0.2.0 (python 3.9.18) (Linux-5.15.0-122-generic-x86_64-with-glibc2.35) **\n==== collecting tests\n==== 3 tests in 3 groups\n==== running tests\n..PP.P\n==== tests executed in 10 seconds\n==== results\n- examples/readme.py::demo_resource_no_scope_first_test() [PASSED]\n- examples/readme.py::demo_resource_no_scope_second_test() [PASSED]\n- examples/readme.py::demo_resource_no_scope_third_test() [PASSED]\n==== 3 passed\n```\n\nYou can share a resource between different tests, regardless of the worker on which they are executed, by using a specific scope.\n\nIn the example below, a resource will be shared at the global scope, meaning all tests can access it, no matter the module, class, or function in which the test is defined.\n\n```python\nimport contextlib\nimport time\n\nimport lymbo\nfrom lymbo import scope_global\n\n\n@contextlib.contextmanager\ndef wait_five_seconds():\n    time.sleep(5)\n    yield\n\n@lymbo.test()\ndef demo_resource_scope_first_test():\n    with scope_global(wait_five_seconds):\n        assert True\n\n\n@lymbo.test()\ndef demo_resource_scope_second_test():\n    with scope_global(wait_five_seconds):\n        assert True\n\n\n@lymbo.test()\ndef demo_resource_scope_third_test():\n    with scope_global(wait_five_seconds):\n        assert True\n```\n\nIn this case, the execution of the 3 tests using 2 workers will take only 5 seconds because the resource is created once and shared among all the tests.\n\n```\n(venv) ~/dev/lymbo$ lymbo examples/ --filter=resource_scope --workers=2\n** lymbo 0.2.0 (python 3.9.18) (Linux-5.15.0-122-generic-x86_64-with-glibc2.35) **\n==== collecting tests\n==== 3 tests in 3 groups\n==== running tests\n..PP.P\n==== tests executed in 5 seconds\n==== results\n- examples/readme.py::demo_resource_scope_first_test() [PASSED]\n- examples/readme.py::demo_resource_scope_second_test() [PASSED]\n- examples/readme.py::demo_resource_scope_third_test() [PASSED]\n==== 3 passed  \n```\n\n## Command line\n\n```\n(venv) ~/dev/lymbo$ lymbo -h\nusage: lymbo [-h] [--version] [--collect] [--groupby {GroupBy.NONE,GroupBy.MODULE,GroupBy.CLASS,GroupBy.FUNCTION}] [--report REPORT]\n             [--log-level {LogLevel.NOTSET,LogLevel.DEBUG,LogLevel.INFO,LogLevel.WARNING,LogLevel.ERROR,LogLevel.CRITICAL}] [--log LOG]\n             [--report-failure {ReportFailure.NONE,ReportFailure.SIMPLE,ReportFailure.NORMAL,ReportFailure.FULL}] [--workers WORKERS]\n             [--filter FILTER]\n             [PATH ...]\n\nA test runner designed for large test suites and small scripts.\n\npositional arguments:\n  PATH                  Path(s) for test collection\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --version             Print the version and exit.\n  --collect             Print the test plan and exit.\n  --groupby {GroupBy.NONE,GroupBy.MODULE,GroupBy.CLASS,GroupBy.FUNCTION}\n                        Grouped tests are executed sequentialy.\n  --report REPORT       Save the report in that directory.\n  --log-level {LogLevel.NOTSET,LogLevel.DEBUG,LogLevel.INFO,LogLevel.WARNING,LogLevel.ERROR,LogLevel.CRITICAL}\n                        The log level\n  --log LOG             Path to the log file.\n  --report-failure {ReportFailure.NONE,ReportFailure.SIMPLE,ReportFailure.NORMAL,ReportFailure.FULL}\n                        The level of detail to display in the console in case of a failure.\n  --workers WORKERS     The number of workers in parrallel (default = number of CPU).\n  --filter FILTER       Select only the tests that match this filter (include full path and parameters).\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcle-b%2Flymbo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcle-b%2Flymbo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcle-b%2Flymbo/lists"}