diff --git a/src/blenderbim/pytest.ini b/src/blenderbim/pytest.ini index 43af31a44d..397268bda9 100644 --- a/src/blenderbim/pytest.ini +++ b/src/blenderbim/pytest.ini @@ -6,6 +6,7 @@ markers = material misc owner + patch project pset_template root diff --git a/src/blenderbim/test/bim/feature/patch.feature b/src/blenderbim/test/bim/feature/patch.feature new file mode 100644 index 0000000000..905eb2896e --- /dev/null +++ b/src/blenderbim/test/bim/feature/patch.feature @@ -0,0 +1,11 @@ +@patch +Feature: Patch + +Scenario: Execute IFC Patch + Given an empty IFC project + And I set "scene.BIMPatchProperties.ifc_patch_recipes" to "OffsetObjectPlacements" + And I set "scene.BIMPatchProperties.ifc_patch_input" to "{cwd}/test/files/basic.ifc" + And I set "scene.BIMPatchProperties.ifc_patch_output" to "{cwd}/test/files/basic-patched.ifc" + And I set "scene.BIMPatchProperties.ifc_patch_args" to "[123454321,0,0,0]" + When I press "bim.execute_ifc_patch" + Then the file "{cwd}/test/files/basic-patched.ifc" should contain "123454321" diff --git a/src/blenderbim/test/bim/module/patch/__init__.py b/src/blenderbim/test/bim/module/patch/__init__.py deleted file mode 100644 index fb33323db9..0000000000 --- a/src/blenderbim/test/bim/module/patch/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# BlenderBIM Add-on - OpenBIM Blender Add-on -# Copyright (C) 2021 Dion Moult -# -# This file is part of BlenderBIM Add-on. -# -# BlenderBIM Add-on is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# BlenderBIM Add-on is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with BlenderBIM Add-on. If not, see . diff --git a/src/blenderbim/test/bim/module/patch/test_operator.py b/src/blenderbim/test/bim/module/patch/test_operator.py deleted file mode 100644 index 2603b1ee7a..0000000000 --- a/src/blenderbim/test/bim/module/patch/test_operator.py +++ /dev/null @@ -1,32 +0,0 @@ -# BlenderBIM Add-on - OpenBIM Blender Add-on -# Copyright (C) 2021 Dion Moult -# -# This file is part of BlenderBIM Add-on. -# -# BlenderBIM Add-on is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# BlenderBIM Add-on is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with BlenderBIM Add-on. If not, see . - -import test.bim.bootstrap - - -class TestExecuteIfcPatch(test.bim.bootstrap.NewFile): - @test.bim.bootstrap.scenario - def test_executing_ifcpatch(self): - return """ - Given I set "scene.BIMPatchProperties.ifc_patch_recipes" to "OffsetObjectPlacements" - And I set "scene.BIMPatchProperties.ifc_patch_input" to "{cwd}/test/files/basic.ifc" - And I set "scene.BIMPatchProperties.ifc_patch_output" to "{cwd}/test/files/basic-patched.ifc" - And I set "scene.BIMPatchProperties.ifc_patch_args" to "[123454321,0,0,0]" - When I press "bim.execute_ifc_patch" - Then the file "{cwd}/test/files/basic-patched.ifc" should contain "123454321" - """ diff --git a/src/blenderbim/test/bim/test_feature.py b/src/blenderbim/test/bim/test_feature.py index bc8a918bf1..8a3c36c61d 100644 --- a/src/blenderbim/test/bim/test_feature.py +++ b/src/blenderbim/test/bim/test_feature.py @@ -136,7 +136,7 @@ def i_set_prop_to_value(prop, value): except: assert False, "Property does not exist" try: - exec(f'bpy.context.{prop} = "{value}"') + exec(f'bpy.context.{prop} = r"{value}"') except: exec(f"bpy.context.{prop} = {value}") @@ -355,3 +355,10 @@ def the_object_name_is_at_location(name, location): assert ( obj_location - Vector([float(co) for co in location.split(",")]) ).length < 0.1, f"Object is at {obj_location}" + + +@then(parsers.parse('the file "{name}" should contain "{value}"')) +def the_file_name_should_contain_value(name, value): + name = replace_variables(name) + with open(name, "r") as f: + assert value in f.read()