Skip to content

Commit 73b2d6e

Browse files
committed
Update tests
1 parent 7c4b98c commit 73b2d6e

4 files changed

Lines changed: 41 additions & 7 deletions

File tree

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ dependencies:
1111
- pybind11
1212
- pyocct >=7.9
1313
- pyside6
14-
- qt6-wayland # [linux]
14+
- sel(linux): qt6-wayland
1515
- cx_Freeze

tests/test_1_app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717

1818
try:
1919
from OCCT import OpenGl # noqa: F401
20+
2021
opengl_unavailable = False
2122

2223
if "CI" in os.environ and sys.platform != "win32":
23-
opengl_unavailable = True # Disable
24+
opengl_unavailable = True # Disable
2425

2526
except ImportError:
2627
opengl_unavailable = True
2728

2829

29-
3030
@pytest.mark.skipif(opengl_unavailable, reason="OpenGL not available")
3131
def test_app():
3232
p = subprocess.Popen("declaracad", stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

tests/test_3_examples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ def test_example(qt_app, path: str):
3030
return
3131
if "chamfer_profile" in path:
3232
try:
33-
from OCCT.ChFi3d import ChFi3d_Linear
33+
from OCCT.ChFi3d import ChFi3d_Linear # noqa: F401
3434
except ImportError:
3535
pytest.skip("ChFi3d_Linear profile not available")
3636
return
3737
with open(path) as f:
3838
if "from SMESH" in f.read():
3939
try:
40-
import SMESH
40+
import SMESH # noqa: F401
4141
except ImportError:
4242
pytest.skip("SMESH not available")
4343
return

tests/test_4_exchange.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,40 @@
77
88
"""
99

10+
from OCCT.TopoDS import TopoDS_Shape
1011

11-
def test_load_dxf():
12-
pass
12+
from declaracad.occ.api import load_model
13+
14+
15+
def test_load_dxf(qt_app):
16+
options = {"from_string": True}
17+
assembly = load_model(
18+
"""
19+
# Created in DeclaraCAD
20+
from declaracad.occ.api import *
21+
from declaracad.occ.loader import LoadedPart
22+
23+
enamldef Assembly(Part):
24+
LoadedPart: dxf:
25+
attr outside_wire = self.topology.wires[5]
26+
attr inside_wires = [w for w in self.topology.wires if w != outside_wire]
27+
filename = 'examples/models/25-5050.dxf'
28+
color = 'red'
29+
Extrude:
30+
material = 'aluminium'
31+
vector = (0, 0, 1000)
32+
Cut:
33+
color = 'red'
34+
Face:
35+
wires = [dxf.outside_wire]
36+
color = 'red'
37+
Looper:
38+
iterable << dxf.inside_wires
39+
Face:
40+
wires = [loop.item]
41+
42+
""",
43+
options,
44+
".enaml",
45+
)[0]
46+
assert isinstance(assembly.render(), TopoDS_Shape)

0 commit comments

Comments
 (0)