Exemple #1
0
    def setUp(self):
        """
        This imports the test_jobs_package, which is required by many tests
        to exercise different parts of hoplite

        __import__ returns a module object which can then be used to invoke
        the different sub-modules imported by name in the last argument. I am
        using this because we install the package at runtime with pip,
        so we have to import at runtime.

        This simplifies development where new test plugins need to be created
        to exercise code. It also allows us to have one dev_requirements file
        instead of one per OS.
        """
        # Monkey patch pip so it doesn't mess with logging. Otherwise, presence
        # of nose xunit logging handlers will
        # cause an error when pip tries to set logging things
        def blank_func(blank_arg):
            pass
        import pip.basecommand
        pip.basecommand.__dict__['logging_dictConfig'] = blank_func

        install_package_with_pip(TEST_PACKAGE_PATH)
        reload_site_packages()
        self.test_jobs_module = __import__('test_jobs_package', globals(), locals(), ['constants',
                                                                                      'throw_an_exception_job',
                                                                                      'wait_10_seconds_job',
                                                                                      'create_file_job',
                                                                                      'throw_job_failed_exception'], -1)
Exemple #2
0
    def setUp(self):
        """
        This imports the test_jobs_package, which is required by many tests
        to exercise different parts of hoplite

        __import__ returns a module object which can then be used to invoke
        the different sub-modules imported by name in the last argument. I am
        using this because we install the package at runtime with pip,
        so we have to import at runtime.

        This simplifies development where new test plugins need to be created
        to exercise code. It also allows us to have one dev_requirements file
        instead of one per OS.
        """

        # Monkey patch pip so it doesn't mess with logging. Otherwise, presence
        # of nose xunit logging handlers will
        # cause an error when pip tries to set logging things
        def blank_func(blank_arg):
            pass

        import pip.basecommand
        pip.basecommand.__dict__['logging_dictConfig'] = blank_func

        install_package_with_pip(TEST_PACKAGE_PATH)
        reload_site_packages()
        self.test_jobs_module = __import__(
            'test_jobs_package', globals(), locals(), [
                'constants', 'throw_an_exception_job', 'wait_10_seconds_job',
                'create_file_job', 'throw_job_failed_exception'
            ], -1)
 def test_get_names_of_hot_installed_package(self):
     pip_args = ["install", TEST_ENTRY_POINT_PATH]
     run_pip(pip_args)
     reload_site_packages()
     for syspath in sys.path:
         pkg_resources.working_set.add_entry(syspath)
     try:
         self.manager = EntryPointManager('entry.point.test')
         names = self.manager.get_plugin_names()
         self.assertIn("entry_point_1", names)
         self.assertIn("entry_point_2", names)
     except Exception, e:
         raise e
Exemple #4
0
 def tearDown(self):
     uninstall_package_with_pip('test-jobs')
     reload_site_packages()
Exemple #5
0
 def tearDown(self):
     uninstall_package_with_pip('test-jobs')
     reload_site_packages()
 def setUpClass(cls):
     # Install hoplite so that its entry points are added
     pip_args = ["install", os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')]
     run_pip(pip_args)
     reload_site_packages()