<commit_before># -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------------

from unittest import main
from os import remove
from os.path import exists, isdir, join
from shutil import rmtree
from tempfile import mkdtemp
from json import dumps
from gzip import GzipFile
from time import sleep

from qiita_client.testing import PluginTestCase

from qtp_target_gene import plugin


class PluginTests(PluginTestCase):
    def setUp(self):
        self.out_dir = mkdtemp()
        self._clean_up_files = [self.out_dir]

    def tearDown(self):
        for fp in self._clean_up_files:
            if exists(fp):
                if isdir(fp):
                    rmtree(fp)
                else:
                    remove(fp)

    def _wait_job(self, job_id):
        for i in range(10):
            status = self.qclient.get_job_info(job_id)['status']
            if status != 'running':
                break
            sleep(0.5)
        return status

    def test_plugin_summary(self):
        artifact_id = 1<commit_msg>sleep(1)<commit_after># -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------------

from unittest import main
from os import remove
from os.path import exists, isdir, join
from shutil import rmtree
from tempfile import mkdtemp
from json import dumps
from gzip import GzipFile
from time import sleep

from qiita_client.testing import PluginTestCase

from qtp_target_gene import plugin


class PluginTests(PluginTestCase):
    def setUp(self):
        self.out_dir = mkdtemp()
        self._clean_up_files = [self.out_dir]

    def tearDown(self):
        for fp in self._clean_up_files:
            if exists(fp):
                if isdir(fp):
                    rmtree(fp)
                else:
                    remove(fp)

    def _wait_job(self, job_id):
        for i in range(10):
            status = self.qclient.get_job_info(job_id)['status']
            if status != 'running':
                break
            sleep(1)
        return status

    def test_plugin_summary(self):
        artifact_id = 1
{'fraction_non_alphanumeric': 0.18178339073861463, 'fraction_numerical': 0.007654037504783774, 'mean_word_length': 1.6087824351297406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3730026', 'n_tokens_mistral': 710, 'n_tokens_neox': 662, 'n_words': 223}