-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logging and pytest marker for slow and azure tests
- Loading branch information
Jianjie Liu (MAIDAP)
committed
Jan 26, 2021
1 parent
b6d1af7
commit 1cbe5ad
Showing
8 changed files
with
83 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
COMPUTER_VISION_ENDPOINT = "https://enki-vision.cognitiveservices.azure.com/" | ||
SEARCH_SERVICE_NAME = "ocr-ner-pipeline" | ||
SKILLSET_NAME = "testocrskillset" | ||
INDEX_NAME = "testocrindex" | ||
INDEXER_NAME = "testocrindexer" | ||
DATASOURCE_NAME = "syntheticimages" | ||
DATASOURCE_CONTAINER_NAME = "testocrimages" | ||
BLOB_NAME = "syntheticimages" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import logging | ||
import os | ||
|
||
import pytest | ||
from dotenv import load_dotenv | ||
|
||
from tests.required_env import RequiredEnvVar | ||
|
||
ENV_FILEPATH = "tests/.env" | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def load_azure_resources(): | ||
# Loading the non-secrets | ||
load_dotenv(ENV_FILEPATH) | ||
logging.info(f"Loading .env from {ENV_FILEPATH}") | ||
logging.debug("Printing environment vars: ") | ||
for env in RequiredEnvVar: | ||
logging.debug(f"\t{env.value}: {os.environ.get(env.value)}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from enum import Enum | ||
from itertools import chain | ||
|
||
|
||
class RequiredSecrets(Enum): | ||
BLOB_KEY = 'BLOB_KEY' | ||
SEARCH_SERVICE_KEY = 'SEARCH_SERVICE_KEY' | ||
COGNITIVE_SERVICE_KEY = 'COGNITIVE_SERVICE_KEY' | ||
|
||
|
||
class RequiredConstants(Enum): | ||
COMPUTER_VISION_ENDPOINT = 'COMPUTER_VISION_ENDPOINT' | ||
SEARCH_SERVICE_NAME = 'SEARCH_SERVICE_NAME' | ||
SKILLSET_NAME = 'SKILLSET_NAME' | ||
INDEX_NAME = "INDEX_NAME" | ||
INDEXER_NAME = "INDEXER_NAME" | ||
DATASOURCE_NAME = "DATASOURCE_NAME" | ||
DATASOURCE_CONTAINER_NAME = "DATASOURCE_CONTAINER_NAME" | ||
BLOB_NAME = "BLOB_NAME" | ||
|
||
|
||
RequiredEnvVar = Enum("RequiredEnvVar", [ | ||
(i.name, i.value) for i in chain(RequiredSecrets, RequiredConstants) | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters