def setUp(self):
        """Initialize stuff"""
        #self.tmpdir = invenio.config.CFG_TMPDIR
        config.CFG_TMPDIR = tempfile.gettempdir()

        self.oldstdout = sys.stdout
        self.oldstderr = sys.stderr
        self.stdout = None
        self.stderr = None

        self.taxonomy_name = "test"

        self.log_level = bconfig.logging_level
        bconfig.set_global_level(bconfig.logging.CRITICAL)
    def setUp(self):
        """Initialize stuff"""
        #self.tmpdir = invenio.config.CFG_TMPDIR
        config.CFG_TMPDIR = tempfile.gettempdir()

        self.oldstdout = sys.stdout
        self.oldstderr = sys.stderr
        self.stdout = None
        self.stderr = None

        self.taxonomy_name = "test"

        self.log_level = bconfig.logging_level
        bconfig.set_global_level(bconfig.logging.CRITICAL)
Beispiel #3
0
    def setUp(self):
        """Initialize stuff"""
        ## NOTE next time please make sure that you change global variables
        ## back to initial values in tearDown. Thank you!!!
        self.__CFG_TMPDIR = config.CFG_TMPDIR
        config.CFG_TMPDIR = tempfile.gettempdir()

        self.oldstdout = sys.stdout
        self.oldstderr = sys.stderr
        self.stdout = None
        self.stderr = None

        self.taxonomy_name = "test"
        from invenio import bibclassify_config as bconfig
        self.log = bconfig.get_logger("bibclassify.tests")
        self.log_level = bconfig.logging_level
        bconfig.set_global_level(bconfig.logging.CRITICAL)
Beispiel #4
0
 def tearDown(self):
     config.CFG_TMPDIR = self.original_tmpdir
     if self.stdout:
         self.unredirect()
     bconfig.set_global_level(self.log_level)
 def tearDown(self):
     if self.stdout:
         self.unredirect()
     bconfig.set_global_level(self.log_level)
        "--check-taxonomy": "check_taxonomy",
        "--detect-author-keywords": "with_author_keywords",
        "-d": "with_author_keywords",
        "--extract-acronyms": "extract_acronyms",
        "-e": "extract_acronyms",
        "--only-core-tags": "only_core_tags",
    }

    for option, argument in opts:
        if option in ("-h", "--help"):
            _display_help()
        elif option in ("-V", "--version"):
            _display_version()
        elif option in ("-v", "--verbose"):
            log.setLevel(int(argument))
            bconfig.set_global_level(int(argument))
        elif option in ("-f", "--file"):
            options["text_files"].append(argument)
        elif option in with_argument:
            options[with_argument[option]] = argument
        elif option in without_argument:
            options[without_argument[option]] = True
        else:
            # This shouldn't happen as gnu_getopt should already handle
            # that case.
            log.error("option unrecognized -- %s" % option)

    # Collect the text inputs.
    options["text_files"] = args

    # Test if the options are consistent.
 def tearDown(self):
     config.CFG_TMPDIR = self.original_tmpdir
     if self.stdout:
         self.unredirect()
     bconfig.set_global_level(self.log_level)
Beispiel #8
0
        "--check-taxonomy": "check_taxonomy",
        "--detect-author-keywords": "with_author_keywords",
        "-d": "with_author_keywords",
        "--extract-acronyms": "extract_acronyms",
        "-e": "extract_acronyms",
        "--only-core-tags": "only_core_tags",
    }

    for option, argument in opts:
        if option in ("-h", "--help"):
            _display_help()
        elif option in ("-V", "--version"):
            _display_version()
        elif option in ("-v", "--verbose"):
            log.setLevel(int(argument))
            bconfig.set_global_level(int(argument))
        elif option in ("-f", "--file"):
            options["text_files"].append(argument)
        elif option in with_argument:
            options[with_argument[option]] = argument
        elif option in without_argument:
            options[without_argument[option]] = True
        else:
            # This shouldn't happen as gnu_getopt should already handle
            # that case.
            log.error("option unrecognized -- %s" % option)


    # Collect the text inputs.
    options["text_files"] = args
Beispiel #9
0
 def tearDown(self):
     if self.stdout:
         self.unredirect()
     from invenio import bibclassify_config as bconfig
     bconfig.set_global_level(self.log_level)
     config.CFG_TMPDIR = self.__CFG_TMPDIR
 def tearDown(self):
     if self.stdout:
         self.unredirect()
     bconfig.set_global_level(self.log_level)