Metadata-Version: 2.1
Name: pytest-testslide
Version: 2.6.3
Summary: TestSlide fixture for pytest
Home-page: https://github.com/facebookincubator/TestSlide/tree/master/pytest-testslide
Maintainer: Balint Csergo
Maintainer-email: deathowlzz@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Testing :: Acceptance
Classifier: Topic :: Software Development :: Testing :: BDD
Classifier: Topic :: Software Development :: Testing :: Mocking
Classifier: Topic :: Software Development :: Testing :: Unit  
Description-Content-Type: text/markdown
Requires-Dist: testslide (>=2.6.3)
Requires-Dist: pytest (~=6.2)
Requires-Dist: pytest-asyncio (>=0.14.0)
Provides-Extra: build
Requires-Dist: black ; extra == 'build'
Requires-Dist: flake8 ; extra == 'build'
Requires-Dist: mypy ; extra == 'build'

[TestSlide](https://testslide.readthedocs.io/) fixture for pytest.

## Quickstart

Install:

```
pip install pytest-testslide
```

In your test file:
```
        import pytest
        from pytest_testslide import testslide
        from testslide import StrictMock # if you wish to use StrictMock
        from testslide import matchers # if you wish to use Rspec style argument matchers
        .....
        def test_mock_callable_patching_works(testslide):
            testslide.mock_callable(time, "sleep").to_raise(RuntimeError("Mocked!")) #mock_callable
            with pytest.raises(RuntimeError):
                time.sleep()

        @pytest.mark.asyncio
        async def test_mock_async_callable_patching_works(testslide):
            testslide.mock_async_callable(sample_module.ParentTarget, "async_static_method").to_raise(RuntimeError("Mocked!")) #mock_async_callable
            with pytest.raises(RuntimeError):
                await sample_module.ParentTarget.async_static_method("a", "b")

        def test_mock_constructor_patching_works(testslide):
            testslide.mock_constructor(sample_module, "ParentTarget").to_raise(RuntimeError("Mocked!"))  #mock_constructor
            with pytest.raises(RuntimeError):
                sample_module.ParentTarget()

        def test_patch_attribute_patching_works(testslide):
            testslide.patch_attribute(sample_module.SomeClass, "attribute", "patched") #patch_attribute
            assert sample_module.SomeClass.attribute == "patched"

```



