Skip to content

thinkAmi-sandbox/python_mock-sample

Repository files navigation

python_mock-sample

 

Tested environment

Mac

  • Mac OS X 10.11.6
  • Python 3.6.1
  • pytest 3.0.7

 

Windows

tested only e.g_mocking_module sample

  • Windows10 x64
  • Python 3.5.2 32bit
  • pytest 3.0.5

 

Samples

  • e.g._mocking_module/
    • replace disabled package to mock
  • e.g._get_mock_object/
    • get mock object from another mock object
  • e.g._set_self_attr/
    • sample: unittest.mock.object(autospect=True)
  • e.g._called_count/
    • assert called count & called args using MagicMock
  • e.g._mocking_decorator
    • patch decorator using unittest.mock.patch
  • e.g._patch_constant
    • patch constant using unittest.mock.patch

 

Related Blog (Written in Japanese)

About

Python : usage unittest.mock samples

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages