materialsintelligence / propnet

A knowledge graph for Materials Science.
Other
72 stars 23 forks source link

Registry questions #250

Open mkhorton opened 5 years ago

mkhorton commented 5 years ago
clegaspi commented 5 years ago
  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 commented 5 years ago

Thanks!