Search code examples
pythonvirtualenvconfigparser

ConfigParser Is Pulling in an Old File


I'm trying to write unit tests for a file that use ConfigParser to read in a properties but for some reason it's pulling in an outdated file that's no longer on my filesystem (at least that I can find). This was introduced when I pulled in a git change from a coworker. My local file updated but ConfigParser is still pulling in the non-updated file.

I've tried searching for any cached files in the directory

$ find . -name *.properties

Is there any sort of cache that I may be missing? I've deleted .cache/, tests/__pycache__/, and all compiled .pyc files.

I'm using virtualenv for my testing but I'm seeing this issue even when I recreate the virtual env.

The offending code snippet:

config = ConfigParser.RawConfigParser()
config.read('config.properties')

Any help would be greatly appreciated!

Edit: Added code snippet


Solution

  • I finally found it!

    I was seeing the issue while running the unit tests. As I poked around more, I found a helper method that was dynamically creating the properties file in question. This helper method never got updated with the newest properties.