Skip to content

Commit fb3023b

Browse files
committed
Moved blenderbim tests temporary files to separate directory
Moved temporary test files to separate directory and added it to gitignore Still have test.exp.cache.dat spawning from `test_feature`...
1 parent 52f18fe commit fb3023b

File tree

7 files changed

+46
-39
lines changed

7 files changed

+46
-39
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ src/ifcopenshell-python/test/build
8484
# blenderbim libs
8585
src/blenderbim/blenderbim/libs
8686

87+
# blenderbim test temp files
88+
src/blenderbim/test/files/temp
89+
8790
# ifcopenshell swig and compiled files
8891
src/ifcopenshell-python/ifcopenshell/_ifcopenshell_wrapper.so
8992
src/ifcopenshell-python/ifcopenshell/ifcopenshell_wrapper.py

src/blenderbim/test/bim/feature/geometry.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Scenario: Switch representation - current edited representation is updated prior
8787
And I press "bim.switch_representation(ifc_definition_id={representation}, should_reload=True)"
8888
And the variable "representation" is "[r for r in {ifc}.by_type('IfcShapeRepresentation') if r.RepresentationType=='Annotation2D'][0].id()"
8989
And I press "bim.switch_representation(ifc_definition_id={representation}, should_reload=True)"
90-
When I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
90+
When I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc')"
9191
Then the object "IfcWall/Cube" dimensions are "4,4,0"
9292

9393
Scenario: Switch representation - current edited representation is discarded if switching to a box
@@ -101,7 +101,7 @@ Scenario: Switch representation - current edited representation is discarded if
101101
And I press "bim.switch_representation(obj='IfcWall/Cube', ifc_definition_id={representation}, should_reload=True)"
102102
And the variable "representation" is "{ifc}.by_type('IfcShapeRepresentation')[0].id()"
103103
And I press "bim.switch_representation(obj='IfcWall/Cube', ifc_definition_id={representation}, should_reload=True)"
104-
When I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
104+
When I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc')"
105105
Then the object "IfcWall/Cube" dimensions are "2,2,2"
106106

107107
Scenario: Switch representation - existing Blender modifiers must be purged
@@ -316,9 +316,9 @@ Scenario: Override duplicate move - copying a coloured representation
316316
And the object "IfcWall/Cube" is selected
317317
And the material "Material" colour is set to "1,0,0,1"
318318
When I press "object.duplicate_move"
319-
And I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
319+
And I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc')"
320320
And an empty Blender session is started
321-
And I press "bim.load_project(filepath='{cwd}/test/files/export.ifc')"
321+
And I press "bim.load_project(filepath='{cwd}/test/files/temp/export.ifc')"
322322
Then the material "Material" colour is "1,0,0,1"
323323
And the object "IfcWall/Cube" has the material "Material"
324324
And the object "IfcWall/Cube.001" has the material "Material"

src/blenderbim/test/bim/feature/patch.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@ Scenario: Execute IFC Patch - file in memory
55
Given an empty IFC project
66
And I set "scene.BIMPatchProperties.ifc_patch_recipes" to "OffsetObjectPlacements"
77
And I set "scene.BIMPatchProperties.should_load_from_memory" to "True"
8-
And I set "scene.BIMPatchProperties.ifc_patch_output" to "{cwd}/test/files/basic-patched.ifc"
8+
And I set "scene.BIMPatchProperties.ifc_patch_output" to "{cwd}/test/files/temp/basic-patched.ifc"
99
And I set "scene.BIMPatchProperties.ifc_patch_args" to "[123454321,0,0,0]"
1010
When I press "bim.execute_ifc_patch(use_json_for_args=True)"
11-
Then the file "{cwd}/test/files/basic-patched.ifc" should contain "123454321"
11+
Then the file "{cwd}/test/files/temp/basic-patched.ifc" should contain "123454321"
1212

1313
Scenario: Execute IFC Patch - file from disk
1414
Given an empty IFC project
1515
And I set "scene.BIMPatchProperties.ifc_patch_recipes" to "OffsetObjectPlacements"
1616
And I set "scene.BIMPatchProperties.ifc_patch_input" to "{cwd}/test/files/basic.ifc"
17-
And I set "scene.BIMPatchProperties.ifc_patch_output" to "{cwd}/test/files/basic-patched.ifc"
17+
And I set "scene.BIMPatchProperties.ifc_patch_output" to "{cwd}/test/files/temp/basic-patched.ifc"
1818
And I set "scene.BIMPatchProperties.ifc_patch_args" to "[123454321,0,0,0]"
1919
When I press "bim.execute_ifc_patch(use_json_for_args=True)"
20-
Then the file "{cwd}/test/files/basic-patched.ifc" should contain "123454321"
20+
Then the file "{cwd}/test/files/temp/basic-patched.ifc" should contain "123454321"
2121

2222
Scenario: Run migrate patch
2323
Given an empty Blender session
24-
When I press "bim.run_migrate_patch(infile='{cwd}/test/files/ifc2x3.ifc', outfile='{cwd}/test/files/ifc2x3-migrated.ifc', schema='IFC4')"
25-
Then the file "{cwd}/test/files/ifc2x3-migrated.ifc" should contain "IFC4"
24+
When I press "bim.run_migrate_patch(infile='{cwd}/test/files/ifc2x3.ifc', outfile='{cwd}/test/files/temp/ifc2x3-migrated.ifc', schema='IFC4')"
25+
Then the file "{cwd}/test/files/temp/ifc2x3-migrated.ifc" should contain "IFC4"

src/blenderbim/test/bim/feature/project.feature

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -359,77 +359,77 @@ Scenario: Unlink IFC
359359

360360
Scenario: Export IFC - blank project
361361
Given an empty IFC project
362-
When I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
362+
When I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc')"
363363
Then nothing happens
364364

365365
Scenario: Export IFC - with basic contents
366366
Given an empty Blender session
367367
And I press "bim.load_project(filepath='{cwd}/test/files/basic.ifc')"
368-
When I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
369-
Then "scene.BIMProperties.ifc_file" is "{cwd}/test/files/export.ifc"
368+
When I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc')"
369+
Then "scene.BIMProperties.ifc_file" is "{cwd}/test/files/temp/export.ifc"
370370

371371
Scenario: Export IFC - with basic contents and saving as another file
372372
Given an empty Blender session
373373
And I press "bim.load_project(filepath='{cwd}/test/files/basic.ifc')"
374-
When I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc', should_save_as=True)"
375-
Then "scene.BIMProperties.ifc_file" is "{cwd}/test/files/export.ifc"
374+
When I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc', should_save_as=True)"
375+
Then "scene.BIMProperties.ifc_file" is "{cwd}/test/files/temp/export.ifc"
376376

377377
Scenario: Export IFC - with basic contents and saving as IfcJSON where import is not supported
378378
Given an empty Blender session
379379
And I press "bim.load_project(filepath='{cwd}/test/files/basic.ifc')"
380-
When I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifcjson', should_save_as=True)"
380+
When I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifcjson', should_save_as=True)"
381381
Then "scene.BIMProperties.ifc_file" is "{cwd}/test/files/basic.ifc"
382382

383383
Scenario: Export IFC - with basic contents and round-tripping an IfcZip
384384
Given an empty Blender session
385385
And I press "bim.load_project(filepath='{cwd}/test/files/basic.ifc')"
386-
When I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifczip', should_save_as=True)"
386+
When I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifczip', should_save_as=True)"
387387
Then "scene.BIMProperties.ifc_file" is "{cwd}/test/files/basic.ifc"
388388
When an empty Blender session is started
389-
And I press "bim.load_project(filepath='{cwd}/test/files/export.ifczip')"
389+
And I press "bim.load_project(filepath='{cwd}/test/files/temp/export.ifczip')"
390390
Then the object "IfcProject/My Project" is an "IfcProject"
391391

392392
Scenario: Export IFC - with basic contents and saving as a relative path
393393
Given an empty Blender session
394394
And I press "bim.load_project(filepath='{cwd}/test/files/basic.ifc')"
395-
When I press "wm.save_mainfile(filepath='{cwd}/test/files/export.blend')"
396-
And I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc', use_relative_path=True)"
395+
When I press "wm.save_mainfile(filepath='{cwd}/test/files/temp/export.blend')"
396+
And I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc', use_relative_path=True)"
397397
Then "scene.BIMProperties.ifc_file" is "export.ifc"
398398

399399
Scenario: Export IFC - with deleted objects synchronised
400400
Given an empty IFC project
401401
When the object "IfcBuildingStorey/My Storey" is selected
402402
And I press "object.delete"
403-
And I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
403+
And I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc')"
404404
And an empty Blender session is started
405-
And I press "bim.load_project(filepath='{cwd}/test/files/export.ifc')"
405+
And I press "bim.load_project(filepath='{cwd}/test/files/temp/export.ifc')"
406406
Then the object "IfcBuildingStorey/My Storey" does not exist
407407

408408
Scenario: Export IFC - with moved object location synchronised
409409
Given an empty IFC project
410410
When the object "IfcBuildingStorey/My Storey" is moved to "0,0,1"
411-
And I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
411+
And I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc')"
412412
And an empty Blender session is started
413-
And I press "bim.load_project(filepath='{cwd}/test/files/export.ifc')"
413+
And I press "bim.load_project(filepath='{cwd}/test/files/temp/export.ifc')"
414414
Then the object "IfcBuildingStorey/My Storey" is at "0,0,1"
415415

416416
Scenario: Export IFC - with moved grid axis location synchronised
417417
Given an empty IFC project
418418
And I press "mesh.add_grid"
419419
When the object "IfcGridAxis/01" is moved to "1,0,0"
420-
And I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
420+
And I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc')"
421421
And an empty Blender session is started
422-
And I press "bim.load_project(filepath='{cwd}/test/files/export.ifc')"
422+
And I press "bim.load_project(filepath='{cwd}/test/files/temp/export.ifc')"
423423
Then the object "IfcGridAxis/01" bottom left corner is at "1,-2,0"
424424

425425
Scenario: Export IFC - with changed spatial container synchronised
426426
Given an empty Blender session
427427
And I press "bim.load_project(filepath='{cwd}/test/files/basic.ifc')"
428428
Then the object "IfcSlab/Slab" is in the collection "IfcBuildingStorey/Ground Floor"
429429
When the object "IfcSlab/Slab" is placed in the collection "IfcBuildingStorey/Level 1"
430-
And I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
430+
And I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc')"
431431
And an empty Blender session is started
432-
And I press "bim.load_project(filepath='{cwd}/test/files/export.ifc')"
432+
And I press "bim.load_project(filepath='{cwd}/test/files/temp/export.ifc')"
433433
Then the object "IfcSlab/Slab" is in the collection "IfcBuildingStorey/Level 1"
434434

435435
Scenario: Export IFC - with changed object scale synchronised
@@ -440,9 +440,9 @@ Scenario: Export IFC - with changed object scale synchronised
440440
And I press "bim.assign_class"
441441
And the object "IfcWall/Cube" is selected
442442
When the object "IfcWall/Cube" is scaled to "2"
443-
And I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
443+
And I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc')"
444444
And an empty Blender session is started
445-
And I press "bim.load_project(filepath='{cwd}/test/files/export.ifc')"
445+
And I press "bim.load_project(filepath='{cwd}/test/files/temp/export.ifc')"
446446
Then the object "IfcWall/Cube" dimensions are "4,4,4"
447447

448448
Scenario: Export IFC - with changed style colour synchronised
@@ -454,9 +454,9 @@ Scenario: Export IFC - with changed style colour synchronised
454454
And I press "bim.assign_class"
455455
And the object "IfcWall/Cube" is selected
456456
When the material "Material" colour is set to "1,0,0,1"
457-
And I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
457+
And I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc')"
458458
And an empty Blender session is started
459-
And I press "bim.load_project(filepath='{cwd}/test/files/export.ifc')"
459+
And I press "bim.load_project(filepath='{cwd}/test/files/temp/export.ifc')"
460460
Then the material "Material" colour is "1,0,0,1"
461461

462462
Scenario: Export IFC - with changed style element synchronised
@@ -469,7 +469,7 @@ Scenario: Export IFC - with changed style element synchronised
469469
And the object "IfcWall/Cube" is selected
470470
When I add a material
471471
And the material "Material.001" colour is set to "1,0,0,1"
472-
And I press "export_ifc.bim(filepath='{cwd}/test/files/export.ifc')"
472+
And I press "export_ifc.bim(filepath='{cwd}/test/files/temp/export.ifc')"
473473
And an empty Blender session is started
474-
And I press "bim.load_project(filepath='{cwd}/test/files/export.ifc')"
474+
And I press "bim.load_project(filepath='{cwd}/test/files/temp/export.ifc')"
475475
Then the material "Material.001" colour is "1,0,0,1"

src/blenderbim/test/bim/test_feature.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ def run_test_code():
722722
@when(parsers.parse("I save sample test files"))
723723
@then(parsers.parse("I save sample test files"))
724724
def saving_sample_test_files(and_open_in_blender=None):
725-
filepath = f"{variables['cwd']}/test/files/sample_test_file"
725+
filepath = f"{variables['cwd']}/test/files/temp/sample_test_file"
726726
blend_filepath = f"{filepath}.blend"
727727
bpy.ops.export_ifc.bim(filepath=f"{filepath}.ifc", should_save_as=True)
728728
bpy.ops.wm.save_as_mainfile(filepath=f"{filepath}.blend")
@@ -734,7 +734,7 @@ def saving_sample_test_files(and_open_in_blender=None):
734734
@then(parsers.parse("I save sample test files and open in blender"))
735735
def saving_sample_test_files_and_open_in_blender():
736736
saving_sample_test_files()
737-
filepath = f"{variables['cwd']}/test/files/sample_test_file.blend"
737+
filepath = f"{variables['cwd']}/test/files/temp/sample_test_file.blend"
738738
import subprocess
739739

740740
subprocess.Popen([bpy.app.binary_path, f"{filepath}"])

src/blenderbim/test/tool/test_debug.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,20 @@ def test_run(self):
3434
class TestAddSchemaIdentifier(NewFile):
3535
def test_run(self):
3636
cwd = os.path.dirname(os.path.realpath(__file__))
37-
schema = subject.load_express(os.path.join(cwd, "..", "files", "test.exp"))
37+
schema_path = os.path.join(cwd, "..", "files", "test.exp")
38+
schema = subject.load_express(schema_path)
3839
subject.add_schema_identifier(schema)
3940
assert IfcStore.schema_identifiers[-1] == "IFCROGUE"
41+
os.remove(schema_path + ".cache.dat")
4042

4143

4244
class TestLoadExpress(NewFile):
4345
def test_run(self):
4446
cwd = os.path.dirname(os.path.realpath(__file__))
45-
schema = subject.load_express(os.path.join(cwd, "..", "files", "test.exp"))
47+
schema_path = os.path.join(cwd, "..", "files", "test.exp")
48+
schema = subject.load_express(schema_path)
4649
assert schema.schema_name == "IFCROGUE"
50+
os.remove(schema_path + ".cache.dat")
4751

4852

4953
class TestPurgeHdf5Cache(NewFile):

src/blenderbim/test/tool/test_patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class TestRunMigratePatch(NewFile):
3434
def test_run(self):
3535
cwd = os.path.dirname(os.path.realpath(__file__))
3636
infile = os.path.join(cwd, "..", "files", "ifc2x3.ifc")
37-
outfile = os.path.join(cwd, "..", "files", "ifc2x3-migrated.ifc")
37+
outfile = os.path.join(cwd, "..", "files", "temp", "ifc2x3-migrated.ifc")
3838
subject.run_migrate_patch(infile, outfile, "IFC4")
3939
ifc = ifcopenshell.open(outfile)
4040
assert ifc.schema == "IFC4"

0 commit comments

Comments
 (0)