forked from mirrors/thatmattlove-hyperglass
fixed missing shutil import for CI
This commit is contained in:
parent
d0d05e868f
commit
9b4c61f89c
1 changed files with 23 additions and 22 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
import sys
|
||||
import glob
|
||||
import shutil
|
||||
import inspect
|
||||
import requests
|
||||
from logzero import logger
|
||||
|
|
@ -8,6 +9,28 @@ from logzero import logger
|
|||
working_directory = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
def ci_config():
|
||||
"""Copies test configuration files to usable config files"""
|
||||
try:
|
||||
logger.info("Migrating test config files...")
|
||||
config_dir = os.path.join(working_directory, "hyperglass/configuration/")
|
||||
ci_dir = os.path.join(working_directory, "ci/")
|
||||
test_files = glob.iglob(os.path.join(ci_dir, "*.toml"))
|
||||
for f in test_files:
|
||||
if os.path.exists(f):
|
||||
raise RuntimeError(f"{f} already exists")
|
||||
else:
|
||||
try:
|
||||
shutil.copyfile(f, config_dir)
|
||||
logger.info("Migrated test config files")
|
||||
except:
|
||||
logger.error(f"Failed to migrate {f}")
|
||||
raise
|
||||
except:
|
||||
logger.error("Error migrating test config files")
|
||||
raise
|
||||
|
||||
|
||||
def construct_test(test_query, location, test_target):
|
||||
"""Constructs JSON POST data for test_hyperglass function"""
|
||||
constructed_query = json.dumps(
|
||||
|
|
@ -161,28 +184,6 @@ def ci_test(
|
|||
raise
|
||||
|
||||
|
||||
def ci_config():
|
||||
"""Copies test configuration files to usable config files"""
|
||||
try:
|
||||
logger.info("Migrating test config files...")
|
||||
config_dir = os.path.join(working_directory, "hyperglass/configuration/")
|
||||
ci_dir = os.path.join(working_directory, "ci/")
|
||||
test_files = glob.iglob(os.path.join(ci_dir, "*.toml"))
|
||||
for f in test_files:
|
||||
if os.path.exists(f):
|
||||
raise RuntimeError(f"{f} already exists")
|
||||
else:
|
||||
try:
|
||||
cp(f, config_dir)
|
||||
logger.info("Migrated test config files")
|
||||
except:
|
||||
logger.error(f"Failed to migrate {f}")
|
||||
raise
|
||||
except:
|
||||
logger.error("Error migrating test config files")
|
||||
raise
|
||||
|
||||
|
||||
def flask_dev_server(host, port):
|
||||
"""Starts Flask development server for testing without WSGI/Reverse Proxy"""
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue