Skip to content

Commit

Permalink
Merge 66d47b6 into 6dd0984
Browse files Browse the repository at this point in the history
  • Loading branch information
azeey authored Aug 25, 2023
2 parents 6dd0984 + 66d47b6 commit 054d511
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion examples/scripts/python_api/testFixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import os

from gz.common import set_verbosity
from gz.common5 import set_verbosity
from gz.sim8 import TestFixture, World, world_entity
from gz.math7 import Vector3d

Expand Down
11 changes: 8 additions & 3 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,22 @@ target_compile_definitions(${BINDINGS_MODULE_NAME} PRIVATE
BINDINGS_MODULE_NAME=${BINDINGS_MODULE_NAME})

# TODO(ahcorde): Move this module to gz-common
pybind11_add_module(common MODULE

set(GZ_COMMON_BINDINGS_MODULE_NAME "common${GZ_COMMON_VER}")
pybind11_add_module(${GZ_COMMON_BINDINGS_MODULE_NAME} MODULE
src/gz/common/_gz_common_pybind11.cc
src/gz/common/Console.cc
)

target_link_libraries(common PRIVATE
target_compile_definitions(${GZ_COMMON_BINDINGS_MODULE_NAME} PRIVATE
BINDINGS_MODULE_NAME=${GZ_COMMON_BINDINGS_MODULE_NAME})

target_link_libraries(${GZ_COMMON_BINDINGS_MODULE_NAME} PRIVATE
gz-common${GZ_COMMON_VER}::gz-common${GZ_COMMON_VER}
)

configure_build_install_location(${BINDINGS_MODULE_NAME})
configure_build_install_location(common)
configure_build_install_location(${GZ_COMMON_BINDINGS_MODULE_NAME})

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# Workaround for Clang and pybind11 on Focal
Expand Down
2 changes: 1 addition & 1 deletion python/src/gz/common/_gz_common_pybind11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "Console.hh"

PYBIND11_MODULE(common, m) {
PYBIND11_MODULE(BINDINGS_MODULE_NAME, m) {
m.doc() = "Gazebo Common Python Library.";

m.def(
Expand Down
5 changes: 5 additions & 0 deletions python/src/gz/sim/TestFixture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ defineSimTestFixture(pybind11::object module)
{
pybind11::class_<TestFixture, std::shared_ptr<TestFixture>> testFixture(module, "TestFixture");

// Since this class starts with "Test", pytest thinks it's a test and emits a
// warning when it can't "collect" it.
// Silence the warning by setting `__test__=False`.
testFixture.attr("__test__") = false;

testFixture
.def(pybind11::init<const std::string &>())
.def(
Expand Down
2 changes: 1 addition & 1 deletion python/test/actor_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import datetime
import unittest

from gz.common import set_verbosity
from gz_test_deps.common import set_verbosity
from gz_test_deps.sim import (Actor, K_NULL_ENTITY,
TestFixture, World, world_entity)
from gz_test_deps.math import Pose3d
Expand Down
1 change: 1 addition & 0 deletions python/test/gz_test_deps/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from gz.common5 import *
2 changes: 1 addition & 1 deletion python/test/joint_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os
import unittest

from gz.common import set_verbosity
from gz_test_deps.common import set_verbosity
from gz_test_deps.sim import (K_NULL_ENTITY, TestFixture,
Joint, Model, World, world_entity)
from gz_test_deps.math import Pose3d
Expand Down
2 changes: 1 addition & 1 deletion python/test/link_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os
import unittest

from gz.common import set_verbosity
from gz_test_deps.common import set_verbosity
from gz_test_deps.sim import K_NULL_ENTITY, TestFixture, Link, Model, World, world_entity
from gz_test_deps.math import Matrix3d, Vector3d

Expand Down
2 changes: 1 addition & 1 deletion python/test/model_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os
import unittest

from gz.common import set_verbosity
from gz_test_deps.common import set_verbosity
from gz_test_deps.sim import K_NULL_ENTITY, TestFixture, Model, World, world_entity

class TestModel(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion python/test/sensor_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os
import unittest

from gz.common import set_verbosity
from gz_test_deps.common import set_verbosity
from gz_test_deps.sim import (K_NULL_ENTITY, TestFixture,
Joint, Model, Sensor, World, world_entity)
from gz_test_deps.math import Pose3d
Expand Down
6 changes: 3 additions & 3 deletions python/test/testFixture_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import os
import unittest

from gz.common import set_verbosity
from gz.sim8 import TestFixture, World, world_entity
from gz.math7 import Vector3d
from gz_test_deps.common import set_verbosity
from gz_test_deps.sim import TestFixture, World, world_entity
from gz_test_deps.math import Vector3d

post_iterations = 0
iterations = 0
Expand Down
2 changes: 1 addition & 1 deletion python/test/world_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os
import unittest

from gz.common import set_verbosity
from gz_test_deps.common import set_verbosity
from gz_test_deps.sim import K_NULL_ENTITY, TestFixture, World, world_entity
from gz_test_deps.math import SphericalCoordinates, Vector3d
from gz_test_deps.sdformat import Atmosphere
Expand Down

0 comments on commit 054d511

Please sign in to comment.