From 338fb2fea8dd728a8417f2d4651a41a7b384dfb6 Mon Sep 17 00:00:00 2001 From: John Turner <7strbass@gmail.com> Date: Tue, 17 Dec 2024 16:37:52 -0500 Subject: [PATCH] --[BE] - Miscellaneous minor refactors and cleanup (#2516) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * --This needs to assert; means an expected filetype has no support yet * --properly instantiate light attr mgr test specialization Have to put specialization in namespace due to C++03, ยง14.7.3/2 standard. * --clean up docstrings * --must import quaternion library before habitat_sim for audio compile If not imported here and sim is compiled with audio support, python tests will abort due to the habitat_sim import causing an invalid free() error * --due to quaternion library dtypes, numpy must be version 1.26.4 * --add quaternion reference to files missing it. --- .../actions/install_ubuntu_deps/action.yml | 2 +- examples/tutorials/async_rendering.py | 5 + examples/tutorials/stereo_agent.py | 4 + .../ManagedFileBasedContainer.h | 18 +- .../objectWrappers/ManagedArticulatedObject.h | 2 - .../objectWrappers/ManagedPhysicsObjectBase.h | 2 - .../physics/objectWrappers/ManagedRigidBase.h | 4 - .../objectWrappers/ManagedRigidObject.h | 2 - src/tests/AttributesManagersTest.cpp | 268 +++++++++--------- tests/conftest.py | 4 + tests/test_compare_profiles.py | 4 + tests/test_examples.py | 4 + tests/test_greedy_follower.py | 5 + tests/test_light_setup.py | 4 + tests/test_navmesh.py | 4 + tests/test_noise_models.py | 4 + tests/test_physics_benchmarking.py | 4 + tests/test_profiling_utils.py | 4 + tests/test_random_seed.py | 4 + tests/test_snap_point.py | 4 + tests/test_utils.py | 4 + 21 files changed, 204 insertions(+), 152 deletions(-) diff --git a/.github/actions/install_ubuntu_deps/action.yml b/.github/actions/install_ubuntu_deps/action.yml index 089f43236e..f9e5271cf7 100644 --- a/.github/actions/install_ubuntu_deps/action.yml +++ b/.github/actions/install_ubuntu_deps/action.yml @@ -50,7 +50,7 @@ runs: run: |- echo "Install conda and dependencies" conda install -y pytorch==1.12.1 torchvision==0.13.1 -c pytorch -c nvidia - conda install -y -c conda-forge ninja numpy pytest pytest-cov ccache hypothesis pytest-mock + conda install -y -c conda-forge ninja numpy=1.26.4 pytest pytest-cov ccache hypothesis pytest-mock pip install pytest-sugar pytest-xdist pytest-benchmark opencv-python cython mock shell: bash -el {0} - name: Validate Pytorch Installation diff --git a/examples/tutorials/async_rendering.py b/examples/tutorials/async_rendering.py index 392053f1a8..36c6f0c261 100644 --- a/examples/tutorials/async_rendering.py +++ b/examples/tutorials/async_rendering.py @@ -32,6 +32,11 @@ back to the main thread by calling sim.get_sensor_observations_async_finish() by default. """ + +# Need to import quaternion library here despite it not being used or else importing +# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation +import quaternion # noqa: F401 + import habitat_sim diff --git a/examples/tutorials/stereo_agent.py b/examples/tutorials/stereo_agent.py index 32aa9a54ab..e32d7144b1 100644 --- a/examples/tutorials/stereo_agent.py +++ b/examples/tutorials/stereo_agent.py @@ -5,6 +5,10 @@ import numpy as np +# Need to import quaternion library here despite it not being used or else importing +# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation +import quaternion # noqa: F401 + import habitat_sim cv2 = None diff --git a/src/esp/core/managedContainers/ManagedFileBasedContainer.h b/src/esp/core/managedContainers/ManagedFileBasedContainer.h index d1bb7e701b..4e5abe804f 100644 --- a/src/esp/core/managedContainers/ManagedFileBasedContainer.h +++ b/src/esp/core/managedContainers/ManagedFileBasedContainer.h @@ -120,7 +120,7 @@ class ManagedFileBasedContainer : public ManagedContainer { } // ManagedFileBasedContainer::createObjectFromJSONString /** - * @brief Method to load a Managed Object's data from a file. If the file + * @brief Method to load a Managed Object's data from a file. If the file * type is not supported by specialization of this method, this method * executes and an error is thrown. * @tparam type of document to load. @@ -131,15 +131,19 @@ class ManagedFileBasedContainer : public ManagedContainer { template ManagedFileIOPtr buildManagedObjectFromDoc(const std::string& filename, CORRADE_UNUSED const U& config) { - ESP_ERROR(Mn::Debug::Flag::NoSpace) - << "<" << this->objectType_ - << "> : Failure loading attributes from document `" << filename - << "` of unknown type `" << typeid(U).name() - << "` so unable to build object."; + CORRADE_ASSERT(false, + Cr::Utility::formatString( + "<{}> : Failure loading attributes from document `{}` " + "of unsupported file type `{}` so unable to build " + "object. Make sure a specialization of " + "ManagedFileBasedContainer::buildManagedObjectFromDoc() " + "supporting this file type has been implemented.", + this->objectType_, filename, typeid(U).name()), + nullptr); } // ManagedFileBasedContainer::buildManagedObjectFromDoc /** - * @brief Method to load a Managed Object's data from a file. This is the + * @brief Method to load a Managed Object's data from a file. This is the * JSON specialization, using type inference. * @param filename name of file document to load from * @param config JSON document to read for data diff --git a/src/esp/physics/objectWrappers/ManagedArticulatedObject.h b/src/esp/physics/objectWrappers/ManagedArticulatedObject.h index 608f577df1..6c7b88c13d 100644 --- a/src/esp/physics/objectWrappers/ManagedArticulatedObject.h +++ b/src/esp/physics/objectWrappers/ManagedArticulatedObject.h @@ -346,8 +346,6 @@ class ManagedArticulatedObject /** * @brief Retrieve a comma-separated string holding the header values for the * info returned for this managed object, type-specific. - * TODO : once Magnum supports retrieving key-values of configurations, use - * that to build this data. */ std::string getPhyObjInfoHeaderInternal() const override { diff --git a/src/esp/physics/objectWrappers/ManagedPhysicsObjectBase.h b/src/esp/physics/objectWrappers/ManagedPhysicsObjectBase.h index dbab2d0196..bee39bf500 100644 --- a/src/esp/physics/objectWrappers/ManagedPhysicsObjectBase.h +++ b/src/esp/physics/objectWrappers/ManagedPhysicsObjectBase.h @@ -387,8 +387,6 @@ class AbstractManagedPhysicsObject /** * @brief Retrieve a comma-separated string holding the header values for * the info returned for this managed object, type-specific. - * TODO : once Magnum supports retrieving key-values of configurations, use - * that to build this data. */ virtual std::string getPhyObjInfoHeaderInternal() const = 0; diff --git a/src/esp/physics/objectWrappers/ManagedRigidBase.h b/src/esp/physics/objectWrappers/ManagedRigidBase.h index 45a8e1afcd..d84106b7c0 100644 --- a/src/esp/physics/objectWrappers/ManagedRigidBase.h +++ b/src/esp/physics/objectWrappers/ManagedRigidBase.h @@ -248,8 +248,6 @@ class AbstractManagedRigidBase /** * @brief Retrieve a comma-separated string holding the header values for the * info returned for this managed object, type-specific. - * TODO : once Magnum supports retrieving key-values of configurations, use - * that to build this data. */ std::string getPhyObjInfoHeaderInternal() const override { @@ -263,8 +261,6 @@ class AbstractManagedRigidBase /** * @brief Retrieve a comma-separated string holding the header values for * the info returned for this managed object, rigid-base-specific. - * TODO : once Magnum supports retrieving key-values of configurations, use - * that to build this data. */ virtual std::string getRigidBaseInfoHeaderInternal() const = 0; /** diff --git a/src/esp/physics/objectWrappers/ManagedRigidObject.h b/src/esp/physics/objectWrappers/ManagedRigidObject.h index b260907f58..b98d30748f 100644 --- a/src/esp/physics/objectWrappers/ManagedRigidObject.h +++ b/src/esp/physics/objectWrappers/ManagedRigidObject.h @@ -61,8 +61,6 @@ class ManagedRigidObject /** * @brief Retrieve a comma-separated string holding the header values for * the info returned for this managed object, rigid-base-specific. - * TODO : once Magnum supports retrieving key-values of configurations, use - * that to build this data. */ std::string getRigidBaseInfoHeaderInternal() const override { return "Creation Attributes Name"; diff --git a/src/tests/AttributesManagersTest.cpp b/src/tests/AttributesManagersTest.cpp index 726860b95e..677009e97b 100644 --- a/src/tests/AttributesManagersTest.cpp +++ b/src/tests/AttributesManagersTest.cpp @@ -46,6 +46,136 @@ using Attrs::UVSpherePrimitiveAttributes; namespace { +namespace detail { + +/** + * @brief Test creation, copying and removal of templates for Object, + * Physics and Stage Attributes Managers + * @tparam Class of attributes manager + * @param mgr the Attributes Manager being tested, + * @param handle the handle of the desired attributes template to work with + */ +template +void testCreateAndRemove(std::shared_ptr mgr, const std::string& handle) { + // get starting number of templates + int orignNumTemplates = mgr->getNumObjects(); + // verify template is not present - should not be + bool isPresentAlready = mgr->getObjectLibHasHandle(handle); + CORRADE_VERIFY(!isPresentAlready); + + // create template from source handle, register it and retrieve it + // Note: registration of template means this is a copy of registered + // template + auto attrTemplate1 = mgr->createObject(handle, true); + // verify it exists + CORRADE_VERIFY(attrTemplate1); + // verify ID exists + bool idIsPresent = mgr->getObjectLibHasID(attrTemplate1->getID()); + CORRADE_VERIFY(idIsPresent); + // retrieve a copy of the named attributes template + auto attrTemplate2 = mgr->getObjectOrCopyByHandle(handle); + // verify copy has same quantities and values as original + CORRADE_COMPARE(attrTemplate1->getHandle(), attrTemplate2->getHandle()); + + // test changing a user-defined field in each template, verify the templates + // are not now the same + attrTemplate1->setFileDirectory("temp_dir_1"); + attrTemplate2->setFileDirectory("temp_dir_2"); + CORRADE_COMPARE_AS(attrTemplate1->getFileDirectory(), + attrTemplate2->getFileDirectory(), + Cr::TestSuite::Compare::NotEqual); + // get original template ID + int oldID = attrTemplate1->getID(); + + // register modified template and verify that this is the template now + // stored + int newID = mgr->registerObject(attrTemplate2, handle); + // verify IDs are the same + CORRADE_COMPARE(oldID, newID); + + // get another copy + auto attrTemplate3 = mgr->getObjectOrCopyByHandle(handle); + // verify added field is present and the same + CORRADE_COMPARE(attrTemplate3->getFileDirectory(), + attrTemplate2->getFileDirectory()); + // change field in new copy + attrTemplate3->setFileDirectory("temp_dir_3"); + // verify that now they are different + CORRADE_COMPARE_AS(attrTemplate3->getFileDirectory(), + attrTemplate2->getFileDirectory(), + Cr::TestSuite::Compare::NotEqual); + + // test removal + int removeID = attrTemplate2->getID(); + // remove template by ID, acquire copy of removed template + auto oldTemplate = mgr->removeObjectByID(removeID); + // verify it exists + CORRADE_VERIFY(oldTemplate); + // verify there are same number of templates as when we started + CORRADE_COMPARE(orignNumTemplates, mgr->getNumObjects()); + // re-add template copy via registration + int newAddID = mgr->registerObject(attrTemplate2, handle); + // verify IDs are the same + CORRADE_COMPARE(removeID, newAddID); + + // lock template referenced by handle + bool success = mgr->setLock(handle, true); + // attempt to remove attributes via handle + auto oldTemplate2 = mgr->removeObjectByHandle(handle); + // verify no template was deleted + CORRADE_VERIFY(!oldTemplate2); + // unlock template + success = mgr->setLock(handle, false); + + // remove attributes via handle + auto oldTemplate3 = mgr->removeObjectByHandle(handle); + // verify deleted template exists + CORRADE_VERIFY(oldTemplate3); + // verify ID does not exist in library now + idIsPresent = mgr->getObjectLibHasID(oldTemplate3->getID()); + CORRADE_VERIFY(!idIsPresent); + // verify there are same number of templates as when we started + CORRADE_COMPARE(orignNumTemplates, mgr->getNumObjects()); +} // AttributesManagersTest::testCreateAndRemove + +/** + * @brief Specialization : Test creation, copying and removal of templates for + * lights attributes managers. + * @param mgr the Attributes Manager being tested, + * @param handle the handle of the desired attributes template to work with + */ +template <> +void testCreateAndRemove(AttrMgrs::LightLayoutAttributesManager::ptr mgr, + const std::string& handle) { + // get starting number of templates + int origNumTemplates = mgr->getNumObjects(); + + // Source config for lights holds multiple light configurations. + // Create a single template for each defined light in configuration and + // register it. + mgr->createObject(handle, true); + // get number of templates loaded + int numLoadedLights = mgr->getNumObjects(); + + // verify lights were added + CORRADE_COMPARE_AS(numLoadedLights, origNumTemplates, + Cr::TestSuite::Compare::NotEqual); + + // get handles of all lights added + auto lightHandles = mgr->getObjectHandlesBySubstring(); + CORRADE_COMPARE(lightHandles.size(), numLoadedLights); + + // remove all added handles + for (auto handle : lightHandles) { + mgr->removeObjectByHandle(handle); + } + // verify there are same number of templates as when we started + CORRADE_COMPARE(mgr->getNumObjects(), origNumTemplates); + +} // AttributesManagersTest::testCreateAndRemove lighting specialization + +} // namespace detail + /** * @brief Test attributesManagers' functionality via loading, creating, copying * and deleting Attributes. @@ -61,17 +191,9 @@ struct AttributesManagersTest : Cr::TestSuite::Tester { * @param handle the handle of the desired attributes template to work with */ template - void testCreateAndRemove(std::shared_ptr mgr, const std::string& handle); - - /** - * @brief Test creation, copying and removal of templates for lights - * attributes managers. - * @param mgr the Attributes Manager being tested, - * @param handle the handle of the desired attributes template to work with - */ - void testCreateAndRemoveLights( - AttrMgrs::LightLayoutAttributesManager::ptr mgr, - const std::string& handle); + void testCreateAndRemove(std::shared_ptr mgr, const std::string& handle) { + detail::testCreateAndRemove(mgr, handle); + } /** * @brief Test creation many templates and removing all but defaults. @@ -279,128 +401,6 @@ AttributesManagersTest::AttributesManagersTest() { }); } -/** - * @brief Test creation, copying and removal of templates for Object, Physics - * and Stage Attributes Managers - * @tparam Class of attributes manager - * @param mgr the Attributes Manager being tested, - * @param handle the handle of the desired attributes template to work with. - */ -template -void AttributesManagersTest::testCreateAndRemove(std::shared_ptr mgr, - const std::string& handle) { - // get starting number of templates - int orignNumTemplates = mgr->getNumObjects(); - // verify template is not present - should not be - bool isPresentAlready = mgr->getObjectLibHasHandle(handle); - CORRADE_VERIFY(!isPresentAlready); - - // create template from source handle, register it and retrieve it - // Note: registration of template means this is a copy of registered - // template - auto attrTemplate1 = mgr->createObject(handle, true); - // verify it exists - CORRADE_VERIFY(attrTemplate1); - // verify ID exists - bool idIsPresent = mgr->getObjectLibHasID(attrTemplate1->getID()); - CORRADE_VERIFY(idIsPresent); - // retrieve a copy of the named attributes template - auto attrTemplate2 = mgr->getObjectOrCopyByHandle(handle); - // verify copy has same quantities and values as original - CORRADE_COMPARE(attrTemplate1->getHandle(), attrTemplate2->getHandle()); - - // test changing a user-defined field in each template, verify the templates - // are not now the same - attrTemplate1->setFileDirectory("temp_dir_1"); - attrTemplate2->setFileDirectory("temp_dir_2"); - CORRADE_COMPARE_AS(attrTemplate1->getFileDirectory(), - attrTemplate2->getFileDirectory(), - Cr::TestSuite::Compare::NotEqual); - // get original template ID - int oldID = attrTemplate1->getID(); - - // register modified template and verify that this is the template now - // stored - int newID = mgr->registerObject(attrTemplate2, handle); - // verify IDs are the same - CORRADE_COMPARE(oldID, newID); - - // get another copy - auto attrTemplate3 = mgr->getObjectOrCopyByHandle(handle); - // verify added field is present and the same - CORRADE_COMPARE(attrTemplate3->getFileDirectory(), - attrTemplate2->getFileDirectory()); - // change field in new copy - attrTemplate3->setFileDirectory("temp_dir_3"); - // verify that now they are different - CORRADE_COMPARE_AS(attrTemplate3->getFileDirectory(), - attrTemplate2->getFileDirectory(), - Cr::TestSuite::Compare::NotEqual); - - // test removal - int removeID = attrTemplate2->getID(); - // remove template by ID, acquire copy of removed template - auto oldTemplate = mgr->removeObjectByID(removeID); - // verify it exists - CORRADE_VERIFY(oldTemplate); - // verify there are same number of templates as when we started - CORRADE_COMPARE(orignNumTemplates, mgr->getNumObjects()); - // re-add template copy via registration - int newAddID = mgr->registerObject(attrTemplate2, handle); - // verify IDs are the same - CORRADE_COMPARE(removeID, newAddID); - - // lock template referenced by handle - bool success = mgr->setLock(handle, true); - // attempt to remove attributes via handle - auto oldTemplate2 = mgr->removeObjectByHandle(handle); - // verify no template was deleted - CORRADE_VERIFY(!oldTemplate2); - // unlock template - success = mgr->setLock(handle, false); - - // remove attributes via handle - auto oldTemplate3 = mgr->removeObjectByHandle(handle); - // verify deleted template exists - CORRADE_VERIFY(oldTemplate3); - // verify ID does not exist in library now - idIsPresent = mgr->getObjectLibHasID(oldTemplate3->getID()); - CORRADE_VERIFY(!idIsPresent); - // verify there are same number of templates as when we started - CORRADE_COMPARE(orignNumTemplates, mgr->getNumObjects()); - -} // AttributesManagersTest::testCreateAndRemove - -void AttributesManagersTest::testCreateAndRemoveLights( - AttrMgrs::LightLayoutAttributesManager::ptr mgr, - const std::string& handle) { - // get starting number of templates - int origNumTemplates = mgr->getNumObjects(); - - // Source config for lights holds multiple light configurations. - // Create a single template for each defined light in configuration and - // register it. - mgr->createObject(handle, true); - // get number of templates loaded - int numLoadedLights = mgr->getNumObjects(); - - // verify lights were added - CORRADE_COMPARE_AS(numLoadedLights, origNumTemplates, - Cr::TestSuite::Compare::NotEqual); - - // get handles of all lights added - auto lightHandles = mgr->getObjectHandlesBySubstring(); - CORRADE_COMPARE(lightHandles.size(), numLoadedLights); - - // remove all added handles - for (auto handle : lightHandles) { - mgr->removeObjectByHandle(handle); - } - // verify there are same number of templates as when we started - CORRADE_COMPARE(mgr->getNumObjects(), origNumTemplates); - -} // AttributesManagersTest::testCreateAndRemove - /** * @brief Test creation many templates and removing all but defaults. * @tparam Class of attributes manager @@ -778,7 +778,7 @@ void AttributesManagersTest::testLightLayoutAttributesManager() { "LightLayoutAttributesManager @" << lightConfigFile); // LightAttributesManager config-loaded attributes processing verification - testCreateAndRemoveLights(lightLayoutAttributesManager_, lightConfigFile); + testCreateAndRemove(lightLayoutAttributesManager_, lightConfigFile); } // AttributesManagersTest::LightLayoutAttributesManagerTest diff --git a/tests/conftest.py b/tests/conftest.py index bdd264f6cf..2b160892c7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,6 +10,10 @@ import pytest +# Need to import quaternion library here despite it not being used or else importing +# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation +import quaternion # noqa: F401 + import habitat_sim _test_scene = osp.abspath( diff --git a/tests/test_compare_profiles.py b/tests/test_compare_profiles.py index 3fb23729e7..222907206c 100644 --- a/tests/test_compare_profiles.py +++ b/tests/test_compare_profiles.py @@ -8,6 +8,10 @@ from io import StringIO from unittest.mock import patch +# Need to import quaternion library here despite it not being used or else importing +# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation +import quaternion # noqa: F401 + from habitat_sim.utils import compare_profiles diff --git a/tests/test_examples.py b/tests/test_examples.py index c32a9d4007..c33175cb11 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -7,6 +7,10 @@ import pytest +# Need to import quaternion library here despite it not being used or else importing +# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation +import quaternion # noqa: F401 + import habitat_sim.bindings from utils import run_main_subproc diff --git a/tests/test_greedy_follower.py b/tests/test_greedy_follower.py index 669978a5a2..6e7b22a8fc 100644 --- a/tests/test_greedy_follower.py +++ b/tests/test_greedy_follower.py @@ -7,6 +7,10 @@ import numpy as np import pytest + +# Need to import quaternion library here despite it not being used or else importing +# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation +import quaternion # noqa: F401 import tqdm import habitat_sim @@ -78,6 +82,7 @@ def test_greedy_follower(test_navmesh, move_filter_fn, action_noise, pbar): scene_graph = habitat_sim.SceneGraph() agent = habitat_sim.Agent(scene_graph.get_root_node().create_child()) + print(f"move_filter_fn : {move_filter_fn} action noise : {action_noise}") agent.controls.move_filter_fn = getattr(pathfinder, move_filter_fn) agent.agent_config.action_space["turn_left"].actuation.amount = TURN_DEGREE diff --git a/tests/test_light_setup.py b/tests/test_light_setup.py index a3a10bd60d..b936e8e871 100644 --- a/tests/test_light_setup.py +++ b/tests/test_light_setup.py @@ -2,6 +2,10 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +# Need to import quaternion library here despite it not being used or else importing +# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation +import quaternion # noqa: F401 + import habitat_sim from habitat_sim.gfx import ( DEFAULT_LIGHTING_KEY, diff --git a/tests/test_navmesh.py b/tests/test_navmesh.py index fb1208e042..818ccf4b36 100644 --- a/tests/test_navmesh.py +++ b/tests/test_navmesh.py @@ -9,6 +9,10 @@ import numpy as np import pytest +# Need to import quaternion library here despite it not being used or else importing +# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation +import quaternion # noqa: F401 + import habitat_sim import habitat_sim.utils.settings diff --git a/tests/test_noise_models.py b/tests/test_noise_models.py index b9678821f0..64964b4541 100644 --- a/tests/test_noise_models.py +++ b/tests/test_noise_models.py @@ -9,6 +9,10 @@ import numpy as np import pytest +# Need to import quaternion library here despite it not being used or else importing +# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation +import quaternion # noqa: F401 + import habitat_sim from habitat_sim.sensors.noise_models import redwood_depth_noise_model from habitat_sim.sensors.noise_models.redwood_depth_noise_model import ( diff --git a/tests/test_physics_benchmarking.py b/tests/test_physics_benchmarking.py index c3eb7cdad9..6bb329f767 100644 --- a/tests/test_physics_benchmarking.py +++ b/tests/test_physics_benchmarking.py @@ -6,6 +6,10 @@ import pytest +# Need to import quaternion library here despite it not being used or else importing +# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation +import quaternion # noqa: F401 + import habitat_sim import habitat_sim.utils.settings diff --git a/tests/test_profiling_utils.py b/tests/test_profiling_utils.py index 5d76d65509..01f119b997 100644 --- a/tests/test_profiling_utils.py +++ b/tests/test_profiling_utils.py @@ -12,6 +12,10 @@ import pytest +# Need to import quaternion library here despite it not being used or else importing +# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation +import quaternion # noqa: F401 + from habitat_sim.utils import profiling_utils _ENV_VAR_NAME = "HABITAT_PROFILING" diff --git a/tests/test_random_seed.py b/tests/test_random_seed.py index c77849bc78..849eb4c687 100644 --- a/tests/test_random_seed.py +++ b/tests/test_random_seed.py @@ -2,6 +2,10 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +# Need to import quaternion library here despite it not being used or else importing +# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation +import quaternion # noqa: F401 + import habitat_sim import habitat_sim.utils.settings diff --git a/tests/test_snap_point.py b/tests/test_snap_point.py index 66dc93ee15..2cec89e37c 100644 --- a/tests/test_snap_point.py +++ b/tests/test_snap_point.py @@ -6,6 +6,10 @@ import hypothesis import pytest + +# Need to import quaternion library here despite it not being used or else importing +# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation +import quaternion # noqa: F401 from hypothesis import strategies as st import habitat_sim diff --git a/tests/test_utils.py b/tests/test_utils.py index 5a630a1981..7047eef026 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -4,6 +4,10 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. +# Need to import quaternion library here despite it not being used or else importing +# habitat_sim below will cause an invalid free() when audio is enabled in sim compilation +import quaternion # noqa: F401 + from habitat_sim.utils.collect_env import main as collect_env