Apr
9
awarded Popular Question
Mar
29
asked why `tasklist | find "cmd.exe"` doesn't work on win7 but xp and vista?
Jan
28
awarded Notable Question
Jan
26
asked I have a server in japan, how to use it as a proxy server that I can access some website through it?
Jan
14
asked How could a https site enable external http link without warning from browser?
Jan
11
comment How to assert a dict contains another dict without assertDictContainsSubset in python?
great, thanks for your answer. :)
Jan
11
accepted How to assert a dict contains another dict without assertDictContainsSubset in python?
Jan
11
comment How to assert a dict contains another dict without assertDictContainsSubset in python?
This works for me, and it's straightforward. Thanks, and items() is equals to iteritems() right?
Jan
11
asked How to assert a dict contains another dict without assertDictContainsSubset in python?
Dec
24
asked How asp.net website supports https(ssl)?
Dec
20
comment Can I mock a method with specified parameters by using `mock` in python?
thank you very much.
Dec
20
accepted Can I mock a method with specified parameters by using `mock` in python?
Dec
2
asked Can I mock a method with specified parameters by using `mock` in python?
Dec
2
accepted How to load my fake module every time when `import a real module` in python?
Dec
2
comment How to load my fake module every time when `import a real module` in python?
before all of the codes, use this: sys.modules['powervc.common.client'] = mock.MagicMock()
Dec
2
comment How to load my fake module every time when `import a real module` in python?
OK, I finally find a way for this:
Nov
29
comment How to load my fake module every time when `import a real module` in python?
thanks for update, but seems you still didn't catch me, here in your my/functions.py, the cleaner and worker is not methods like cleaner() and worker(), it's a import statement. The difference is, if it's a method, it will not be loaded when you import my.functions, but if it's a import statement, it will automatically load and execute the class when import my.functions. My purpose is to replace the behavior of import my.functions.cleaner in function.py, let it not executed when load my.functions. Do you have any idea?
Nov
28
comment How to load my fake module every time when `import a real module` in python?
@WernerHenze no, not depends, it's just when import function get called, from my.functions import cleaner will be get called that I don't want it to.
Nov
28
comment How to load my fake module every time when `import a real module` in python?
Thanks, yes I know I can dynamically replace the methods or attributes to python object, but here is not replace a method or attribute, it's replace a "import ..." statement. Do you have any idea?
Nov
28
comment How to load my fake module every time when `import a real module` in python?
when you import function, wouldn't from my.functions import cleaner get executed?
1 2 3 4 5