localize mathutils dependency in tests #3895

replaced shapebuilder with general ifcopenshell code in `test_add_boolean` (the only place besides `test_shape_builder` where it was used), that way mathutils dependency in tests is localized only to `test_shape_builder.py`.

added test-safe option to makefile, so github workflow would ignore `test_shape_builder` tests for now and it wouldn't interrupt the entire workflow
This commit is contained in:
Andrej730
2023-10-17 15:36:10 +05:00
parent 578e15adb2
commit 3f018a4195
4 changed files with 23 additions and 10 deletions
+1 -2
View File
@@ -88,7 +88,6 @@ jobs:
sudo /usr/bin/python -m pip install networkx
sudo /usr/bin/python -m pip install tabulate
sudo /usr/bin/python -m pip install python-dateutil
sudo /usr/bin/python -m pip install mathutils
- name: Test
run: |
@@ -96,4 +95,4 @@ jobs:
sudo /usr/bin/python tests.py
cd ../src/ifcopenshell-python
mv ifcopenshell ifcopenshell-local # Force testing on installed module
make test
make test-safe
+1 -2
View File
@@ -114,7 +114,6 @@ jobs:
sudo /usr/bin/python -m pip install https://github.com/Andrej730/aud/archive/refs/heads/master-reduced-size.zip
sudo /usr/bin/python -m pip install tabulate
sudo /usr/bin/python -m pip install python-dateutil
sudo /usr/bin/python -m pip install mathutils
- name: Test
run: |
@@ -122,4 +121,4 @@ jobs:
sudo /usr/bin/python tests.py
cd ../src/ifcopenshell-python
mv ifcopenshell ifcopenshell-local # Force testing on installed module
make test
make test-safe
+6
View File
@@ -68,6 +68,12 @@ endif
test:
pytest -p no:pytest-blender test
# safe version of tests without mathutils dependency
# for tests to work for github workflow with python <3.10 #3895
.PHONY: test-safe
test-safe:
pytest -p no:pytest-blender test --ignore=test/util/test_shape_builder.py
.PHONY: build-ids-docs
build-ids-docs:
mkdir -p test/build
@@ -19,11 +19,10 @@
import test.bootstrap
import ifcopenshell.api
import numpy as np
from ifcopenshell.util.shape_builder import ShapeBuilder
class TestAddBoolean(test.bootstrap.IFC4):
def test_returning_ifc_boolean_result(self):
def test_returning_ifc_boolean_clipping_result(self):
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
model = ifcopenshell.api.run("context.add_context", self.file, context_type="Model")
body = ifcopenshell.api.run(
@@ -36,11 +35,21 @@ class TestAddBoolean(test.bootstrap.IFC4):
)
wall = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
builder = ShapeBuilder(self.file)
extrusion = builder.extrude(builder.rectangle())
rep = builder.get_representation(body, extrusion)
profile = self.file.create_entity(
"IfcIShapeProfileDef",
ProfileName="HEA100",
ProfileType="AREA",
OverallWidth=100,
OverallDepth=96,
WebThickness=5,
FlangeThickness=8,
FilletRadius=12,
)
rep = ifcopenshell.api.run(
"geometry.add_profile_representation", self.file, context=body, profile=profile, depth=5
)
ifcopenshell.api.run("geometry.assign_representation", self.file, product=wall, representation=rep)
ifcopenshell.api.run("geometry.add_boolean", self.file, representation=rep, matrix=np.eye(4))
assert rep.Items[0].is_a() == "IfcBooleanResult"
assert rep.Items[0].is_a() == "IfcBooleanClippingResult"
assert rep.RepresentationType == "CSG"