Skip to content

armirusco/sleuth

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sleuth

A minimal Python mocking library

Usage

Watch calls with sleuth.watch

with sleuth.watch("some.path.to.thing") as mock:
    result = thing(1, a=2)
    self.assertTrue(mock.called)
    self.assertEqual(1, mock.call_count)
    self.assertEqual([((1,), {a:2})], mock.calls)
    self.assertEqual(result, mock.call_returns[0])

Replace functions with sleuth.switch...

with sleuth.switch("some.path.to.thing", lambda x: 'something') as mock:
    thing(1, a=2)
    self.assertTrue(mock.called)
    self.assertTrue(['something'], mock.call_returns)

About

A minimal Python mocking library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%