<commit_before>from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str

import re
from os import remove, path
from sys import version_info
from nose import SkipTest
from nose.tools import assert_equal
from functools import wraps
from sqlalchemy.exc import IntegrityError
from indra.db import DatabaseManager, texttypes, get_defaults
from nose.plugins.attrib import attr
IS_PY3 = True
if version_info.major is not 3:
    IS_PY3 = False
if IS_PY3:
    from indra.db.manage_content import Medline, PmcOA, Manuscripts

defaults = get_defaults()
test_defaults = {k: v for k, v in defaults.items() if 'test' in k}

# Get host for the test database from system defaults.
# TODO: implement setup-teardown system.
TEST_HOST = None
TEST_HOST_TYPE = ''
key_list = list(test_defaults.keys())
key_list.sort()
for k in key_list:
    v = test_defaults[k]
    m = re.match('(\w+)://.*?/([\w.]+)', v)
    if m is None:
        raise SkipTest(<commit_msg>Add workaround for database tests.<commit_after>from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str

import re
from os import remove, path
from sys import version_info, argv
from nose import SkipTest
from nose.tools import assert_equal
from functools import wraps
from sqlalchemy.exc import IntegrityError
from indra.db import DatabaseManager, texttypes, get_defaults
from nose.plugins.attrib import attr
IS_PY3 = True
if version_info.major is not 3:
    IS_PY3 = False
if IS_PY3:
    from indra.db.manage_content import Medline, PmcOA, Manuscripts

defaults = get_defaults()
test_defaults = {k: v for k, v in defaults.items() if 'test' in k}

# Get host for the test database from system defaults.
# TODO: implement setup-teardown system.
if '-a' in argv:
    attr_str = argv[argv.index('-a')+1]
    if any([not_attr in attr_str for not_attr in
            ('!nonpublic', '!webservice')]):
        raise SkipTest("Every tests is nonpublic and a webservice.")
TEST_HOST = None
TEST_HOST_TYPE = ''
key_list = list(test_defaults.keys())
key_list.sort()
for k in key_list:
    v = test_defaults[k]
    m = re.match('(\w+)://.*?/([\w.]+)', v)
    if m is None:
        raise SkipTest(
{'fraction_non_alphanumeric': 0.09336941813261164, 'fraction_numerical': 0.0040595399188092015, 'mean_word_length': 4.3189448441247, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '733029', 'n_tokens_mistral': 719, 'n_tokens_neox': 697, 'n_words': 253}