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

Registry questions #250

Open
mkhorton opened this issue Jun 7, 2019 · 2 comments
Open

Registry questions #250

mkhorton opened this issue Jun 7, 2019 · 2 comments

Comments

@mkhorton
Copy link
Collaborator

mkhorton commented Jun 7, 2019

  • Why does add_builtin_models_to_registry have to be called?
  • Why does e.g. from propnet.symbols.properties import refractive_index not work ?
@clegaspi
Copy link
Contributor

clegaspi commented Jun 7, 2019

  1. That function was implemented as a bit of a hack to make the tests run correctly. When nose runs, it searches for test modules, imports all of the found modules, and then runs the tests. Registry persists across tests. So, if a test messes with the registry by adding/deleting entries, it must put it back the way it was or clear it before exiting that test module. When import propnet.models or import propnet.symbols is called the first time, this populates the registry (and to your second point, the global namespace). However, calling the import again doesn't do anything because the module is already in the list of imported modules. Hence, to re-import and re-populate the registry with built-in models/symbols, that function is present. I am aware that nose is able to clear the global namespace between test modules with flag --with-isolation, but that breaks test coverage determination.

This is one reason I didn't love the import propnet.models/symbols formalism.

  1. I think it should. Would have to look into it further.

@mkhorton
Copy link
Collaborator Author

mkhorton commented Jun 7, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants