title: How to mock a csv file
body: <p>I have a csv parser module that parses a very specific type of .csv file and extracts fields from it. Now to test this module I'm writing some unit tests. Traditionally, to test the module I would create a sample csv file of the same format but with limited entries and then pass in this file to the module and check the output. Obviously that's not very good because there's a dependency on the test file itself.</p>
  
  <p>What is the right way to go about this? I've read about the <strong>mock</strong> module and how it can mock things. But I have no idea how I can mock a specific file. </p>