forked from mirrors/thatmattlove-hyperglass
removed redundant try block from file copy, changed shutil.copyfile to shutil.copy
This commit is contained in:
parent
286c0b596f
commit
e5184aad0e
1 changed files with 17 additions and 21 deletions
|
|
@ -11,27 +11,23 @@ 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"))
|
||||
status = False
|
||||
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("Successfully migrated test config files")
|
||||
status = True
|
||||
except:
|
||||
logger.error(f"Failed to migrate {f}")
|
||||
raise
|
||||
return status
|
||||
except:
|
||||
logger.error("Error migrating test config files")
|
||||
raise
|
||||
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"))
|
||||
status = False
|
||||
for f in test_files:
|
||||
if os.path.exists(f):
|
||||
raise RuntimeError(f"{f} already exists")
|
||||
else:
|
||||
try:
|
||||
shutil.copy(f, config_dir)
|
||||
logger.info("Successfully migrated test config files")
|
||||
status = True
|
||||
except:
|
||||
logger.error(f"Failed to migrate {f}")
|
||||
raise
|
||||
return status
|
||||
|
||||
|
||||
def construct_test(test_query, location, test_target):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue