{"id":21355682,"url":"https://github.com/arrmansa/strongmock","last_synced_at":"2026-02-27T02:02:38.130Z","repository":{"id":224871493,"uuid":"764211380","full_name":"arrmansa/strongmock","owner":"arrmansa","description":"StrongMock is a powerful mocking library for Python that leverages low-level ctypes functionality to provide extensive mocking capabilities. Some care may be needed while using this.","archived":false,"fork":false,"pushed_at":"2024-03-16T12:20:34.000Z","size":116,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-28T22:40:27.805Z","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":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arrmansa.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-02-27T17:16:30.000Z","updated_at":"2025-04-13T00:15:17.000Z","dependencies_parsed_at":"2024-02-28T06:30:12.709Z","dependency_job_id":"0f9cfc91-bad5-405c-8612-7f367611022d","html_url":"https://github.com/arrmansa/strongmock","commit_stats":null,"previous_names":["arrmansa/strongmock"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/arrmansa/strongmock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrmansa%2Fstrongmock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrmansa%2Fstrongmock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrmansa%2Fstrongmock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrmansa%2Fstrongmock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arrmansa","download_url":"https://codeload.github.com/arrmansa/strongmock/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrmansa%2Fstrongmock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29882627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T23:51:21.483Z","status":"online","status_checked_at":"2026-02-27T02:00:06.759Z","response_time":57,"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":[],"created_at":"2024-11-22T04:19:25.330Z","updated_at":"2026-02-27T02:02:33.122Z","avatar_url":"https://github.com/arrmansa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# StrongMock\n\nEver wanted **Unlimited Power** while patching things ? \n\nStrongMock is a powerful mocking library for Python that leverages low-level ctypes functionality to provide extensive mocking capabilities. Some care may be needed while using this.\n\n# Functionality/Usage\n\n## Basic \n\n1. Instead of `from unittest.mock import patch` use `from strongmock import strongpatch`. \n2. `strongpatch` is an alias for `patch` in the module, meaning `from strongmock import patch` can also be used.\n3. Full compatibility - all methods and classes present in `unittest.mock` are present in `strongmock`.\n4. `isinstance` compatibility - limited to `Mock`, `MagicMock` and `AsyncMock`.\n\n## More features\n\n### `strongpatch.equal_basic_objects`\nCan make floats / ints / True False and other basic objects equal to each other. \\\nThis customization of the equality behavior of basic objects can be useful when you have to test very very specific edge cases, maybe something governing program flow etc. Can also be used as a context manager.\n\n### `strongpatch.mock_imports`\nReplaces imports with Magicmock, takes in a tuple of strings, optional parameter override which decides if we override existing imports as well (True by default). Can also be used as a context manager.\n\n# Async\n\nAlso works on async functions, with similar stronger patching\n\n# Safety\n\nSome care has been taken to avoid crashes and breakage, but the user does have full control. One word answer - no.\n## Note - we have 100% Coverage, all Testcases passing\n\n# Working and usage\n\n## strongpatch\n\nThis applies when the target of a `strongmock.strongpatch` is a function defined in python with a `__code__` attribute. For other cases (methods in a class, classes, lbrary functions in c, etc.), the behaviour is the same as `unittest.patch`.\\\nThis will patch the `__code__` attribute of the function to call the mock, meaning that references will also have the functionality of mock. \\\nThis can be extremely convenient in some cases.\n\n## strongpatch.mock_imports\n\nWe can pass testcases that need imports inside them\n\n```python\nclass TestImportPatch(unittest.TestCase):\n    @strongpatch.mock_imports((\"somelib_abcd\",))\n    def test_import_somelib_abcd(self):\n        import somelib_abcd\n        self.assertIsInstance(somelib_abcd.somefn(), MagicMock)\n```\n\n## strongpatch.equal_basic_objects\n\nWe dump the bytes from objsrc to objdst, meaning we can do basically do `True = False` or `1 = 2` (not `==` as in comparison but `=` as in assignment)\n\n### huh?\n\nYes, you can now pass these testcases.\n\n```python\nimport unittest\nfrom strongmock import strongpatch\nclass StrongMockDemoTest(unittest.TestCase):\n    @strongpatch.equal_basic_objects(False, True)\n    def test_truefalse_patch_0(self):\n        if True != False:\n            raise RuntimeError(\"TRUEFALSE PATCH FAILED\")\n```\n\n# Links\n[PyPi](https://pypi.org/project/strongmock) \\\n[GitHub](https://github.com/arrmansa/strongmock)\n\n# License\nStrongMock is licensed under the Unlicense. See the LICENSE file for details.\n\n# Official theme music\nWhen using these methods, it is recommended that you listen to this for better code. \\\n[Kai's Theme Epic Version (Slowed + BassBoosted)](https://www.youtube.com/watch?v=uMvNQRSKccg)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farrmansa%2Fstrongmock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farrmansa%2Fstrongmock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farrmansa%2Fstrongmock/lists"}