File: __init__.py

package info (click to toggle)
q2-feature-classifier 2024.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,504 kB
  • sloc: python: 3,730; makefile: 38; sh: 16
file content (37 lines) | stat: -rw-r--r-- 1,207 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2023, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------

import tempfile
import shutil
from warnings import filterwarnings

from qiime2.plugin.testing import TestPluginBase


class FeatureClassifierTestPluginBase(TestPluginBase):
    package = 'q2_feature_classifier.tests'

    def setUp(self):
        try:
            from q2_feature_classifier.plugin_setup import plugin
        except ImportError:
            self.fail("Could not import plugin object.")

        self.plugin = plugin

        self.temp_dir = tempfile.TemporaryDirectory(
            prefix='q2-feature-classifier-test-temp-')

        filterwarnings('ignore', 'The TaxonomicClassifier ', UserWarning)

    def _setup_dir(self, filenames, dirfmt):
        for filename in filenames:
            filepath = self.get_data_path(filename)
            shutil.copy(filepath, self.temp_dir.name)

        return dirfmt(self.temp_dir.name, mode='r')