[nbdev] testing for configfiles

I’m having troubles conceptualizing decoupling of testing for existence and content of config files from my local config files setup.
Using the old paradigm with extra test modules, there’ wasn’t an overlap with the actual config filepath, one could use fully temporary filepaths for testing.
But having the working code and test in the same notebook I fail to see how to circumvent below problems:

  • Checking for a config file with path $HOME/.myproject.toml should raise at first use of the software and point the user to a set-up routine
    • this fails during local test b/c my local set up has that file
    • it will work on the GitHub workflow test though
    • If I wouldn’t check for raising, it would not fail the local test but obviously fail on GitHub
  • Filling the config file path with a random path for testing would over-write my local config file’s content.

Any tips on how I could decouple this with using nbdev would be appreciated!

I must admit I don’t fully understand what you are trying to achieve or what the problem is. If you could describe your problem in more detail and also pretend like I don’t know / understand what your other config files are about or even what they are for, and explain to me like I’m a beginner that would help.

Also concrete example that someone can use to reproduce your issue would be very helpful by example I mean an actual repo with files and a step by step guide on how to reproduce

Thanks

1 Like

I think part of the issue is a bad (for testing) design of my config module. I think I found some way to create a testable layout using a Config class and monkeypatching.
Thanks for your reply!