Anshu Kumar <anshu.kumar...@gmail.com> writes:

> I need to mock file reader object , i tried using
> @patch('__builtin__.open') but it will patch my all file open readers.

For this reason I have written and published the Gajja library
<URL:https://pypi.python.org/pypi/gajja/>.

Its FileDouble objects will allow fine-grained control over exactly
which file accesses are mocked, leaving the rest to behave normally.

To date it is only used in one code base. I would be pleased to receive
feedback either to my email address or at the “testing in Python” forum
<URL:http://lists.idyll.org/listinfo/testing-in-python>.

-- 
 \       “I never forget a face, but in your case I'll be glad to make |
  `\                                      an exception.” —Groucho Marx |
_o__)                                                                  |
Ben Finney

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to