title: Unit test for a config module that loads values from a file
body: <p>New to Unit testing (using pytest) and trying to workout how I can test a config module which loads its values from an ini file in a way that isolates it from its environment. </p>
  
  <p>I want to test that the values in the file are the same as what was loaded to the Configuration instance.</p>
  
  <p>As shown the ini file is hardcoded in the module but don't want to be tied to config.ini when its potentially unavailable.</p>
  
  <p>This is a simplied version of the config module:</p>
  
  <pre><code>from configparser import ConfigParser
  
  class Configuration():
      def __init__(self, ini_file):
          parser = ConfigParser()
          parser.read(ini_file)
  
          for section_name in parser.sections():
              self.__dict__.update(parser.items(section_name))
  
  config = Configuration('config.ini')
  </code></pre>
  
  <p>I access the config values like this:</p>
  
  <pre><code>from config import config
  
  print(config.port)
  </code></pre>
  
  <p>Any help much appreciated.</p>