Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnexpectedMethodCallError in an other module call mocked time.localtime() #27

Open
ivancrneto opened this issue Jan 6, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@ivancrneto
Copy link
Owner

  1. mox the time.localtime()
  2. call time.localtime() in an other moudle
time.gmtime(time.mktime((2012, 10, 1, 15, 26,0,0,0,0))) 
self.mox.stubout(time, 'localtime') 
time.localtime().returns?(t) 
self.mox.replay_all()
print("mox localtime:", time.localtime())    # correct
othermoudle.func() # call time.localtime() in func()  # error

I got a correct mox time:

(Pdb) time.localtime() 
time.struct_time(tm_year=2012, tm_mon=10, tm_mday

and then call time.localtime in an other module, I got an error:

(Pdb) time.time() 
1333178201.334844 
(Pdb) time.localtime() 
UnexpectedMethodCallError: Unexpected method call Stub for <built-in function 
localtime>.call() -> None 
@ivancrneto ivancrneto added bug Something isn't working good first issue Good for newcomers labels Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant