예제 #1
0
from repologyapp import app

# setup test client
if 'REPOLOGY_CONFIG' not in os.environ:
    requires_database = pytest.mark.skip(
        'flask tests require database filled with test data; please prepare the database and configuration file (see repology-test.conf.default for reference) and pass it via REPOLOGY_CONFIG environment variable'
    )
else:

    def requires_database(test):
        return test

    #requires_database = lambda _: _

test_client = app.test_client()

# setup tidy
TIDY_OPTIONS = {'drop-empty-elements': False, 'doctype': 'html5'}

try:
    from tidylib import tidy_document
    _, errors = tidy_document(
        '<!DOCTYPE html><html><head><title>test</title></head><body><nav>test</nav></body></html>'
    )
    if errors.find('<nav> is not recognized') != -1:
        raise RuntimeError('Tidylib does not support HTML5')
    html_validation = True
except ImportError:
    print('Unable to import tidylib, HTML validation is disabled',
          file=sys.stderr)
예제 #2
0
 def setUp(self):
     self.app = app.test_client()
예제 #3
0
 def setUp(self) -> None:
     self.app = app.test_client()