# limitations under the License.
# ******************************************************************************
# pylint: disable=redefined-outer-name
import gzip
import json
import sys
import hug
from io import open
import io
import os
from os.path import dirname
import pytest
import server.serve
from nlp_architect.utils.text import try_to_load_spacy
from server.serve import api
if not try_to_load_spacy('en'):
    pytest.skip(
        "\n\nSkipping test_server_sanity.py. Reason: 'spacy en' model not installed. "
        "Please see https://spacy.io/models/ for installation instructions.\n"
        "The terms and conditions of the data set and/or model license apply.\n"
        "Intel does not grant any rights to the data and/or model files.\n",
        allow_module_level=True)

sys.path.insert(0, (dirname(dirname(os.path.abspath(__file__)))))

headers = {
    "clean": "True",
    "display_post_preprocces": "True",
    "display_tokens": "",
    "display_token_text": "True",
    "IS-HTML": "False"
# limitations under the License.
# ******************************************************************************
# pylint: disable=redefined-outer-name
import os
from os import path

import pytest

from nlp_architect import LIBRARY_OUT
from nlp_architect.utils.text import try_to_load_spacy
from .topic_extraction import main as topic_ex_main
from .trend_analysis import analyze as trend_analyze

pytestmark = pytest.mark.skipif(True, reason="Test fails on Linux")

if not try_to_load_spacy("en"):
    pytest.skip(
        "\n\nSkipping test_spacy_np_annotator.py. Reason: 'spacy en' model not installed."
        "Please see https://spacy.io/models/ for installation instructions.\n"
        "The terms and conditions of the data set and/or model license apply.\n"
        "Intel does not grant any rights to the data and/or model files.\n",
        allow_module_level=True,
    )

current_dir = os.path.dirname(os.path.realpath(__file__))
ta_path = str(LIBRARY_OUT / "trend-analysis-data")
target_corpus_path = path.join(ta_path, "target_corpus.csv")
reference_corpus_path = path.join(ta_path, "reference_corpus.csv")


@pytest.fixture