Skip to content

Commit

Permalink
Fix skipping tests when navigation/navmeshgen are not built.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxwell175 committed Feb 27, 2022
1 parent d354f11 commit c2e728d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
8 changes: 0 additions & 8 deletions tests/navigation/conftest.py

This file was deleted.

15 changes: 11 additions & 4 deletions tests/navigation/test_nav_mesh_bam.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pytest
from panda3d import core


Expand All @@ -18,7 +19,9 @@ def reconstruct(object):
return object


def test_nav_mesh_bam(navmeshgen, navigation):
def test_nav_mesh_bam():
navigation = pytest.importorskip("panda3d.navigation")
navmeshgen = pytest.importorskip("panda3d.navmeshgen")
data = core.GeomVertexData("", core.GeomVertexFormat.get_v3(), core.Geom.UH_static)
vertex = core.GeomVertexWriter(data, "vertex")
vertex.add_data3((0, 0, 0))
Expand Down Expand Up @@ -63,7 +66,9 @@ def test_nav_mesh_bam(navmeshgen, navigation):
assert detailTriCount == navmeshBam.get_detail_tri_count()


def test_nav_mesh_node_bam(navmeshgen, navigation):
def test_nav_mesh_node_bam():
navigation = pytest.importorskip("panda3d.navigation")
navmeshgen = pytest.importorskip("panda3d.navmeshgen")
data = core.GeomVertexData("", core.GeomVertexFormat.get_v3(), core.Geom.UH_static)
vertex = core.GeomVertexWriter(data, "vertex")
vertex.add_data3((0, 0, 0))
Expand Down Expand Up @@ -109,7 +114,9 @@ def test_nav_mesh_node_bam(navmeshgen, navigation):
assert detailTriCount == navmeshNodeBam.get_nav_mesh().get_detail_tri_count()


def test_nav_query_bam(navmeshgen, navigation):
def test_nav_query_bam():
navigation = pytest.importorskip("panda3d.navigation")
navmeshgen = pytest.importorskip("panda3d.navmeshgen")
data = core.GeomVertexData("", core.GeomVertexFormat.get_v3(), core.Geom.UH_static)
vertex = core.GeomVertexWriter(data, "vertex")
vertex.add_data3((0, 0, 0))
Expand Down Expand Up @@ -152,4 +159,4 @@ def test_nav_query_bam(navmeshgen, navigation):
pathBam = query.find_path(posBam, core.LPoint3(100, 0, 3))

assert pos == posBam
assert path == pathBam
assert path == pathBam
7 changes: 0 additions & 7 deletions tests/navmeshgen/conftest.py

This file was deleted.

12 changes: 9 additions & 3 deletions tests/navmeshgen/test_mesh_gen.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import pytest
from panda3d import core


def test_input_geom(navmeshgen):
def test_input_geom():
navigation = pytest.importorskip("panda3d.navigation")
navmeshgen = pytest.importorskip("panda3d.navmeshgen")
data = core.GeomVertexData("", core.GeomVertexFormat.get_v3(), core.Geom.UH_static)
vertex = core.GeomVertexWriter(data, "vertex")
vertex.add_data3((0, 0, 0))
Expand Down Expand Up @@ -38,7 +41,10 @@ def test_input_geom(navmeshgen):
assert vcount == 6
assert tcount == 4

def test_poly_mesh(navmeshgen):

def test_poly_mesh():
navigation = pytest.importorskip("panda3d.navigation")
navmeshgen = pytest.importorskip("panda3d.navmeshgen")
data = core.GeomVertexData("", core.GeomVertexFormat.get_v3(), core.Geom.UH_static)
vertex = core.GeomVertexWriter(data, "vertex")
vertex.add_data3((0, 0, 0))
Expand Down Expand Up @@ -77,4 +83,4 @@ def test_poly_mesh(navmeshgen):
assert nverts == 230
assert npolys == 112
assert builder.vert_count == 6
assert builder.tri_count == 4
assert builder.tri_count == 4

0 comments on commit c2e728d

Please sign in to comment.