mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +00:00
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:
@@ -88,7 +88,6 @@ jobs:
|
|||||||
sudo /usr/bin/python -m pip install networkx
|
sudo /usr/bin/python -m pip install networkx
|
||||||
sudo /usr/bin/python -m pip install tabulate
|
sudo /usr/bin/python -m pip install tabulate
|
||||||
sudo /usr/bin/python -m pip install python-dateutil
|
sudo /usr/bin/python -m pip install python-dateutil
|
||||||
sudo /usr/bin/python -m pip install mathutils
|
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
@@ -96,4 +95,4 @@ jobs:
|
|||||||
sudo /usr/bin/python tests.py
|
sudo /usr/bin/python tests.py
|
||||||
cd ../src/ifcopenshell-python
|
cd ../src/ifcopenshell-python
|
||||||
mv ifcopenshell ifcopenshell-local # Force testing on installed module
|
mv ifcopenshell ifcopenshell-local # Force testing on installed module
|
||||||
make test
|
make test-safe
|
||||||
|
|||||||
@@ -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 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 tabulate
|
||||||
sudo /usr/bin/python -m pip install python-dateutil
|
sudo /usr/bin/python -m pip install python-dateutil
|
||||||
sudo /usr/bin/python -m pip install mathutils
|
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
@@ -122,4 +121,4 @@ jobs:
|
|||||||
sudo /usr/bin/python tests.py
|
sudo /usr/bin/python tests.py
|
||||||
cd ../src/ifcopenshell-python
|
cd ../src/ifcopenshell-python
|
||||||
mv ifcopenshell ifcopenshell-local # Force testing on installed module
|
mv ifcopenshell ifcopenshell-local # Force testing on installed module
|
||||||
make test
|
make test-safe
|
||||||
|
|||||||
@@ -68,6 +68,12 @@ endif
|
|||||||
test:
|
test:
|
||||||
pytest -p no:pytest-blender 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
|
.PHONY: build-ids-docs
|
||||||
build-ids-docs:
|
build-ids-docs:
|
||||||
mkdir -p test/build
|
mkdir -p test/build
|
||||||
|
|||||||
@@ -19,11 +19,10 @@
|
|||||||
import test.bootstrap
|
import test.bootstrap
|
||||||
import ifcopenshell.api
|
import ifcopenshell.api
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from ifcopenshell.util.shape_builder import ShapeBuilder
|
|
||||||
|
|
||||||
|
|
||||||
class TestAddBoolean(test.bootstrap.IFC4):
|
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")
|
ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcProject")
|
||||||
model = ifcopenshell.api.run("context.add_context", self.file, context_type="Model")
|
model = ifcopenshell.api.run("context.add_context", self.file, context_type="Model")
|
||||||
body = ifcopenshell.api.run(
|
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")
|
wall = ifcopenshell.api.run("root.create_entity", self.file, ifc_class="IfcWall")
|
||||||
|
|
||||||
builder = ShapeBuilder(self.file)
|
profile = self.file.create_entity(
|
||||||
extrusion = builder.extrude(builder.rectangle())
|
"IfcIShapeProfileDef",
|
||||||
rep = builder.get_representation(body, extrusion)
|
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.assign_representation", self.file, product=wall, representation=rep)
|
||||||
|
|
||||||
ifcopenshell.api.run("geometry.add_boolean", self.file, representation=rep, matrix=np.eye(4))
|
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"
|
assert rep.RepresentationType == "CSG"
|
||||||
|
|||||||
Reference in New Issue
Block a user