-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
conftest.py
29 lines (26 loc) · 1.07 KB
/
conftest.py
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
# coding: utf-8
import os
import sys
import pytest
from sentences import Sentences
import warnings
try:
from gummy.utils._warnings import (GummyImprementationWarning,
EnvVariableNotDefinedWarning)
except ModuleNotFoundError:
here = os.path.abspath(os.path.dirname(__file__))
REPO_DIR = os.path.dirname(here)
sys.path.append(REPO_DIR)
print(f"You didn't install 'Translation-Gummy', so add {REPO_DIR} to search path for modules.")
from gummy.utils._warnings import (GummyImprementationWarning,
EnvVariableNotDefinedWarning)
def pytest_addoption(parser):
parser.addoption("--gummy-warnings", choices=["error", "ignore", "always", "default", "module", "once"], default="ignore")
def pytest_configure(config):
action = config.getoption("gummy_warnings")
warnings.simplefilter(action, category=GummyImprementationWarning)
warnings.simplefilter(action, category=EnvVariableNotDefinedWarning)
@pytest.fixture
def db():
sentences_db = Sentences()
return sentences_db