Skip to content

Instantly share code, notes, and snippets.

@paulohrpinheiro
Last active December 5, 2015 01:06
Show Gist options
  • Save paulohrpinheiro/3a650e0099df2254b086 to your computer and use it in GitHub Desktop.
Save paulohrpinheiro/3a650e0099df2254b086 to your computer and use it in GitHub Desktop.
import unittest
import inspect
import importlib
import app_config # my config for this application
class RequirementsTestCase(unittest.TestCase):
def test_requirement_exist(self):
with open(app_config.REQUIREMENTS) as f: # this config option is the complete file name in project, a requirements.txt
for req_name in f:
module_instance = importlib.import_module(req_name.strip()) # strip, strip, strip!
self.assertTrue(inspect.ismodule(module_instance))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment