Skip to main content

Helper classes for easier mocking and patching tests.

Project description

Helper classes for easier mocking and patching tests.


Latest version released on PyPi Build status of the master branch on Mac/Linux Test coverage


Sample

from mockie import TestCase
from my import module

class MyTest(TestCase):

    def setUp(self):
        self.mock_shutil = self.patch("my.module.shutil")

    def test_my_function_with_side_effects(self):
        module.function()
        self.mock_shutil.rmtree.assert_called_once_with("my_file.txt")

API

TestCase

  • self.Mock

  • self.MagicMock

  • self.patch

  • self.patch_object

  • self.patch_multiple

  • self.patch_dict

  • self.mock_open

  • self.assertCalled

  • self.assertCalledOnceWith

  • self.assertAnyCall

  • self.assertIsMocked

  • self.assertIsMock

  • self.assertIsMagicMock

License (MIT)

The MIT License (MIT)

Copyright (c) 2015 marcwebbie.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mockie-0.0.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

mockie-0.0.1-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file mockie-0.0.1.tar.gz.

File metadata

  • Download URL: mockie-0.0.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for mockie-0.0.1.tar.gz
Algorithm Hash digest
SHA256 62bd6afa000b9e4c0a06aa959d179afc85f943c9e98df4ef974b4ff7195a9485
MD5 87623ce381f80d6b57e362f73275bb8e
BLAKE2b-256 60f2797131defb48214d7ca60db74d7761033c8e9b09ec296f7969fa755e0185

See more details on using hashes here.

File details

Details for the file mockie-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mockie-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 deab25f6b37d2200303acf76c9ece52dce0988c45dc92542424196b2a48f87f3
MD5 97b9fbfc43659047f9cced1268b29170
BLAKE2b-256 07b26a72ec2b644a2e63f9b666846f760b72bcab96ffc38af1d11602de6f4a48

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page