{"id":40847825,"url":"https://github.com/kliu04/explotest","last_synced_at":"2026-01-21T23:17:30.104Z","repository":{"id":292244987,"uuid":"958779661","full_name":"kliu04/explotest","owner":"kliu04","description":"Create Regression Tests from Runtime Arguments","archived":false,"fork":false,"pushed_at":"2025-11-17T04:44:59.000Z","size":1021,"stargazers_count":3,"open_issues_count":9,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-11-17T05:30:34.442Z","etag":null,"topics":["metaprogramming","program-analysis","python","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kliu04.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-01T18:45:12.000Z","updated_at":"2025-11-17T04:44:36.000Z","dependencies_parsed_at":"2025-05-27T20:32:38.062Z","dependency_job_id":"da40d8ef-eb77-47ed-9d35-59cec74608de","html_url":"https://github.com/kliu04/explotest","commit_stats":null,"previous_names":["kliu04/explotest"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/kliu04/explotest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kliu04%2Fexplotest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kliu04%2Fexplotest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kliu04%2Fexplotest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kliu04%2Fexplotest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kliu04","download_url":"https://codeload.github.com/kliu04/explotest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kliu04%2Fexplotest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28646946,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T21:29:11.980Z","status":"ssl_error","status_checked_at":"2026-01-21T21:24:31.872Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["metaprogramming","program-analysis","python","unit-testing"],"created_at":"2026-01-21T23:17:30.044Z","updated_at":"2026-01-21T23:17:30.098Z","avatar_url":"https://github.com/kliu04.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExploTest\n\nExploTest is a tool that turns exploratory test runs into unit tests by capturing and serializing run-time arguments.\nBy adding the `@explore` decorator to any function, ExploTest automatically generates unit tests with assertions based\non the previous execution values.\n## Installation\n```bash\npip install ExploTest\n```\n\n### Local Installation\n\n```bash\npython3 -m pip install -e \u003cpath/to/explotest\u003e\n```\n\n## Usage\n\nOn any function or method (except for closures), add the `@explore` decorator. When this function (the\nfunction-under-test or FUT) is called at runtime, a\nunit test will be generated and saved in same directory as the file of the FUT.\n\nThe `@explore` decorator accepts two optional parameters, `mode` and `explicit_record`.\n\n### Configuration\n\n`mode` determines how the run-time arguments are reconstructed in the unit test:\n\n- Setting this to `\"p\"` or `\"pickle\"` results in ExploTest \"pickling\" (a Python specific binary serialization)\n  each argument into a file, then loading this file in the unit test. ExploTest uses\n  the [dill](https://dill.readthedocs.io/en/latest/) library\n  for pickling, which enables support for function arguments among others. However, objects that cannot be pickled (\n  e.g., Pandas DataFrames) cannot be saved. This is the default behaviour.\n- Setting this to `\"a\"` results in ExploTest attempting to reconstruct the parameter by creating a new object\n  and setting all its fields to the runtime argument.\n  For example, when running the code\n\n```python\nclass Bar:\n    x = 1\n\n\n@explore(mode=\"a\")\ndef baz(b):\n    return\n\n\nbaz(Bar())\n```\n\nthe unit test\n\n```python\n@pytest.fixture\ndef generate_b():\n    clone_b = scratchpad.Bar.__new__(scratchpad.Bar)\n    setattr(clone_b, 'x', 1)\n    return clone_b\n\n\ndef test_baz(generate_b):\n    b = generate_b\n    return_value = scratchpad.baz(b)\n    assert return_value is None\n```\n\nis generated. This will not work for some objects, namely ones that are \"more\" than just a collection of fields or have\nfields that cannot be `setattr`'d. In this case,\nExploTest will try to fall back on pickling.\n\n`explicit_record` determines when ExploTest generates a unit test. By default, this is `False` and so ExploTest\ngenerates a unit test everytime\na function with the `@explore` decorator is called. However, this may become unwieldy if the function is called many\ntimes and\nonly certain tests are desired. By setting `explicit_record` to `True` in a function, a unit test will only be created\nif the function body calls\n`explotest_record()`. Note that due to implementation details, this is not thread safe.\n\nFor example,\n\n```python\n@explore(explicit_record=True)\ndef fib(n):\n    if n \u003c= 1:\n        explotest_record()\n        return 1\n    return fib(n - 1) + fib(n - 2)\n```\n\nA unit test will only be generated for when `n \u003c= 1`.\n\n## Development Setup\n\nCreate a venv, then install `pip-tools`. Run `pip-compile` as specified.\n\n```bash\npython3 -m venv .venv\npip install pip-tools\npip-compile -o requirements.txt ./pyproject.toml\npip install -r requirements.txt\n```\n\n## Copyright\n\nExploTest is free and open source software, licensed under the GNU LGPL v3 or any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkliu04%2Fexplotest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkliu04%2Fexplotest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkliu04%2Fexplotest/lists"}