Questions tagged [pymox]

pymox is a mock object framework for Python. It is based on EasyMock, a Java mock object framework.

pymox is a mock object framework for Python. It is based on EasyMock, a Java mock object framework.

See https://code.google.com/archive/p/pymox/

6 questions
3
votes
1 answer

Pros and Cons of CreateMockAnything() of Mox (pymox) framework

First of all the reason for the question - official pymox documentation: https://code.google.com/p/pymox/wiki/MoxDocumentation There is a statement in MockAnything section telling "Don't use this unless you absolutely have to!". I'm interesting why…
Max Lobur
  • 5,662
  • 22
  • 35
1
vote
0 answers

mocking a function called multiple times using pymox

I have a function in the code that is being called twice. get_user_settings once it is getting called in the function I am testing and second time some different module has a function that calls it again. I have mocked it using pymox like this: mox…
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
1
vote
1 answer

what is difference while doing monkeyPatch and StubOutwithMock?

I came across this while doing unittest, I am curious to know what is the difference between the below two ? self.monkeyPatch(module, 'myFunc', lambda n: someObject) and mox.StubOutWithMock(module,…
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
1
vote
1 answer

How to unit test this code with pymox?

So I have installed pymox and I would like to test this method: class HttpStorage(): def download(self, input, output): try: file_to_download = urllib2.urlopen(input) except URLError: raise…
Richard Knop
  • 81,041
  • 149
  • 392
  • 552
0
votes
1 answer

When using python mox mock objects is there any way to avoid all of them being equal (as in __eq__)?

I'm experiencing some problems derived from the fact than several all mox Mock object of a given class seem to be equal in the ==,__eq__ sense although they are different objects (at least mock1 is mock2 returns False). is there any way to prevent…
RubenLaguna
  • 21,435
  • 13
  • 113
  • 151
0
votes
1 answer

mocking a variable using mox

I want to test this method, however I would need to mock the variable dirContent def imageFilePaths(paths): imagesWithPath = [] for _path in paths: try: dirContent = os.listdir(_path) except OSError: …
Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197