import os import tempfile from steps.common import Case def before_all(context): context.image_template_path = os.path.abspath( os.path.join( os.path.dirname(__file__), "..", "assets" ) ) print("Image template path: {}".format(context.image_template_path)) context.test_images = { "1200.jpg": os.path.join(context.image_template_path, "test_image_1200.jpg"), "100.jpg": os.path.join(context.image_template_path, "test_image_100.jpg"), "500.jpg": os.path.join(context.image_template_path, "test_image_500.jpg"), "1200_16bit_RGB.png": os.path.join(context.image_template_path, "test_image_1200_16bit_rgb.png"), "thumb_normal": os.path.join(context.image_template_path, "test_image_thumb_normal.png"), "thumb_large": os.path.join(context.image_template_path, "test_image_thumb_large.png"), "thumb_x-large": os.path.join(context.image_template_path, "test_image_thumb_x-large.png"), "thumb_xx-large": os.path.join(context.image_template_path, "test_image_thumb_xx-large.png"), } context.bin = os.path.abspath( os.path.join( os.path.dirname(__file__), "..", "..", "target", "debug", "allmytoes" ) ) assert os.path.isfile(context.bin), "{} does not exist".format(context.bin) def before_scenario(context, scenario): wd = tempfile.mkdtemp() context.working_dir = wd context.env = { "RUST_LOG": "trace", "HOME": wd, } context.case = Case( working_dir=wd, test_images=context.test_images, asset_dir=context.image_template_path ) def after_scenario(context, scenario): pass # shutil.rmtree(context.working_dir)