Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract import code into a function and unit test it #80

Open
wendi-yu opened this issue Oct 7, 2020 · 0 comments
Open

Extract import code into a function and unit test it #80

wendi-yu opened this issue Oct 7, 2020 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers plumbing Affects plumbing or PDL code

Comments

@wendi-yu
Copy link
Member

wendi-yu commented Oct 7, 2020

The code that currently produces the import_folder dict is inline and only able to look at the imports 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:

def get_imports(folder_path, mockPaths=None)`

where folder_path is the path to a folder, and mockPaths is an optional list of fake paths to be used for unit testing. Depending on the value of mockPaths, 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.

@wendi-yu wendi-yu added enhancement New feature or request good first issue Good for newcomers plumbing Affects plumbing or PDL code labels Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers plumbing Affects plumbing or PDL code
Projects
None yet
Development

No branches or pull requests

1 participant