def handle(self, *args, **options): self.loglevel = getattr(Logger, options["loglevel"].upper()) cleandocs = options["cleandocs"] build_docs = options["build_docs"] opendocs = options["opendocs"] include_buildstatic_docs = options["include_buildstatic_docs"] self.indexhtmlpath = self.__get_documentation_indexhtml_path() self.fail_on_warning = options["fail_on_warning"] if not (cleandocs or opendocs or build_docs): raise CommandError( "You must specify at least one of: --build, " "--clean or --open. See --help for more info." ) if cleandocs and opendocs and not build_docs: raise CommandError("Can not use --clean and --open without also using --build.") virtualenvutils.add_virtualenv_bin_directory_to_path() if cleandocs: self.__clean_docs() if build_docs: self.__build_sphinx_docs() if include_buildstatic_docs: self.__build_buildstatic_docs() if opendocs: self._opendocs() else: self.get_logger().info('Built docs. Use "ievv docs -o" to open them in your browser to view them.')
def test_add_virtualenv_bin_directory_to_path(self): mockenviron = {'PATH': ''} with mock.patch('ievv_opensource.utils.virtualenvutils.sys.real_prefix', '/real'): with mock.patch('ievv_opensource.utils.virtualenvutils.sys.prefix', '/virtual'): with mock.patch('ievv_opensource.utils.virtualenvutils.os.environ', mockenviron): virtualenvutils.add_virtualenv_bin_directory_to_path() self.assertEqual('{}/virtual/bin'.format(os.pathsep), mockenviron['PATH'])
def handle(self, *args, **options): cleandocs = options['cleandocs'] build_docs = options['build_docs'] opendocs = options['opendocs'] self.indexhtmlpath = self.__get_documentation_indexhtml_path() self.fail_on_warning = options['fail_on_warning'] if not (cleandocs or opendocs or build_docs): raise CommandError('You must specify at least one of: --build, ' '--clean or --open. See --help for more info.') if cleandocs and opendocs and not build_docs: raise CommandError('Can not use --clean and --open without also using --build.') virtualenvutils.add_virtualenv_bin_directory_to_path() if cleandocs: self.__cleandocs() if build_docs: self.__build_docs() if opendocs: self._opendocs()
def setUp(self): self.documentation_build_directory = 'test_documentation_build_directory' self.__remove_documentation_build_directory() virtualenvutils.add_virtualenv_bin_directory_to_path()