Files
Stirling-PDF/testing/cucumber/features/environment.py
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
709 B
Python
Raw Normal View History

2024-05-26 15:58:33 +01:00
import os
2024-05-26 15:58:33 +01:00
def before_all(context):
context.endpoint = None
context.request_data = None
context.files = {}
context.response = None
2024-05-26 15:58:33 +01:00
def after_scenario(context, scenario):
if hasattr(context, "files"):
2024-05-26 15:58:33 +01:00
for file in context.files.values():
file.close()
if os.path.exists("response_file"):
os.remove("response_file")
if hasattr(context, "file_name") and os.path.exists(context.file_name):
2024-05-26 15:58:33 +01:00
os.remove(context.file_name)
# Remove any temporary files
for temp_file in os.listdir("."):
if temp_file.startswith("genericNonCustomisableName") or temp_file.startswith(
"temp_image_"
):
2025-01-11 22:06:46 +01:00
os.remove(temp_file)