Beispiel #1
0
    def setUpClass(cls):
        """Create a new metadata file if it does not exist.

        This is executed before any test is started.
        """
        config = open_config(CONF_FILE)
        if not os.path.isfile(META_FILE):
            sys.stdout.write("Initializing database...\n")
            db.make_meta_db(META_FILE)

            with db.session_scope(META_FILE) as (session, metadata):
                mkmeta = db.MakeMeta(config, IMAGE_DIR)
                mkmeta.make(session, metadata)
Beispiel #2
0
    def setUp(self):
        """Prepare the testing environment."""
        self.config = open_config(CONF_FILE)
        self.train_file = os.path.join(TEMP_DIR, 'train_data.tsv')
        self.ann_file = os.path.join(TEMP_DIR, 'Cypripedium_section.ann')
        self.test_result = os.path.join(TEMP_DIR, 'test_result.tsv')
        self.train_dir = os.path.join(TEMP_DIR, 'train_data')
        self.ann_dir = os.path.join(TEMP_DIR, 'ann_dir')
        self.test_result_batch = os.path.join(TEMP_DIR, 'test_result_batch.tsv')

        for path in (self.train_dir, self.ann_dir):
            if not os.path.isdir(path):
                os.mkdir(path)