Extract import code into a function and unit test it #80
Labels
enhancement
New feature or request
good first issue
Good for newcomers
plumbing
Affects plumbing or PDL code
The code that currently produces the
import_folder
dict is inline and only able to look at theimports
folder where we keep actual imports, which isn't very conducive to unit testing. We should pull it out into a function that takes the path to look for the folder in as an argument, and that also has a mode that yields a fake list of paths to test with. A function signature could look something like this:where
folder_path
is the path to a folder, andmockPaths
is an optional list of fake paths to be used for unit testing. Depending on the value ofmockPaths
, the function either trawls the provided folder path for the list of files or uses the given list directly.We can also ignore files without the
.pdl
extension in in this function, so that we have more flexibility in what goes into the imports folder.The text was updated successfully, but these errors were encountered: