From 378a25bbaa23c27e4ab4b1304467e29d5cacbc1e Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 20 Feb 2023 19:57:05 +0500 Subject: [PATCH] Added some .feature convenience debug fixtures --- src/blenderbim/test/bim/test_feature.py | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/blenderbim/test/bim/test_feature.py b/src/blenderbim/test/bim/test_feature.py index 602b858d46..057f9ddbae 100644 --- a/src/blenderbim/test/bim/test_feature.py +++ b/src/blenderbim/test/bim/test_feature.py @@ -670,3 +670,31 @@ def construction_type(relating_type_name): @when("I move the cursor to the bottom left corner") def move_cursor_bottom_left(): bpy.context.window.cursor_warp(10, 10) + + +@given(parsers.parse("I save sample test files")) +@when(parsers.parse("I save sample test files")) +@then(parsers.parse("I save sample test files")) +def saving_sample_test_files(and_open_in_blender=None): + filepath = f"{variables['cwd']}/test/files/sample_test_file" + blend_filepath = f'{filepath}.blend' + bpy.ops.export_ifc.bim(filepath=f"{filepath}.ifc", should_save_as=True) + bpy.ops.wm.save_as_mainfile(filepath=f"{filepath}.blend") + + +# TODO: merge to single fixture with `saving_sample_test_files`; add "and wait" +@given(parsers.parse("I save sample test files and open in blender")) +@when(parsers.parse("I save sample test files and open in blender")) +@then(parsers.parse("I save sample test files and open in blender")) +def saving_sample_test_files_and_open_in_blender(): + saving_sample_test_files() + filepath = f"{variables['cwd']}/test/files/sample_test_file.blend" + import subprocess + subprocess.Popen([bpy.app.binary_path, f'{filepath}']) + + +@given(parsers.parse("I run pdb")) +@when(parsers.parse("I run pdb")) +@then(parsers.parse("I run pdb")) +def run_pdb(): + import pdb; pdb.set_trace() \ No newline at end of file