test-install.py 651 B

12345678910111213141516171819202122232425262728
  1. """
  2. Test that all of our modules can be imported
  3. Also test that associated constants are set correctly
  4. Thanks https://stackoverflow.com/a/25562415/10473080
  5. """
  6. import importlib
  7. import pkgutil
  8. import unfccc_ghg_data
  9. def import_submodules(package_name):
  10. """
  11. Test import of submodules
  12. """
  13. package = importlib.import_module(package_name)
  14. for _, name, is_pkg in pkgutil.walk_packages(package.__path__):
  15. full_name = package.__name__ + "." + name
  16. importlib.import_module(full_name)
  17. if is_pkg:
  18. import_submodules(full_name)
  19. import_submodules("unfccc_ghg_data")
  20. print(unfccc_ghg_data.__version__)