more flaky fixes

This commit is contained in:
matlabbe
2026-05-27 23:00:53 -07:00
parent 0cd144069c
commit 1a841e8754
4 changed files with 20 additions and 2 deletions
+6
View File
@@ -97,6 +97,12 @@ void PyDescriptor::parseParameters(const ParametersMap & parameters)
_import_array(); _import_array();
// Invalidate importlib's directory-listing caches so a script created
// after sys.path was first scanned in this process is still found.
// Without this, the second Py* instance pointing at a freshly-written
// script in an already-known directory fails with ModuleNotFoundError.
PyRun_SimpleString("import importlib; importlib.invalidate_caches()");
std::string scriptName = uSplit(UFile::getName(path_), '.').front(); std::string scriptName = uSplit(UFile::getName(path_), '.').front();
PyObject * pName = PyUnicode_FromString(scriptName.c_str()); PyObject * pName = PyUnicode_FromString(scriptName.c_str());
UDEBUG("PyImport_Import() beg"); UDEBUG("PyImport_Import() beg");
+6
View File
@@ -46,6 +46,12 @@ PyDetector::PyDetector(const ParametersMap & parameters) :
_import_array(); _import_array();
// Invalidate importlib's directory-listing caches so a script created
// after sys.path was first scanned in this process is still found. Without
// this, the second PyDetector instance pointing at a freshly-written
// script in an already-known directory fails with ModuleNotFoundError.
PyRun_SimpleString("import importlib; importlib.invalidate_caches()");
std::string scriptName = uSplit(UFile::getName(path_), '.').front(); std::string scriptName = uSplit(UFile::getName(path_), '.').front();
PyObject * pName = PyUnicode_FromString(scriptName.c_str()); PyObject * pName = PyUnicode_FromString(scriptName.c_str());
UDEBUG("PyImport_Import() beg"); UDEBUG("PyImport_Import() beg");
+6
View File
@@ -53,6 +53,12 @@ PyMatcher::PyMatcher(
_import_array(); _import_array();
// Invalidate importlib's directory-listing caches so a script created
// after sys.path was first scanned in this process is still found.
// Without this, the second Py* instance pointing at a freshly-written
// script in an already-known directory fails with ModuleNotFoundError.
PyRun_SimpleString("import importlib; importlib.invalidate_caches()");
std::string scriptName = uSplit(UFile::getName(path_), '.').front(); std::string scriptName = uSplit(UFile::getName(path_), '.').front();
PyObject * pName = PyUnicode_FromString(scriptName.c_str()); PyObject * pName = PyUnicode_FromString(scriptName.c_str());
UDEBUG("PyImport_Import"); UDEBUG("PyImport_Import");
+2 -2
View File
@@ -633,12 +633,12 @@ TEST_F(RtabmapIntegrationFixture, PR2_Scan2D_RGBD)
EXPECT_GE(result.gridObstacleCells, 4400); EXPECT_GE(result.gridObstacleCells, 4400);
EXPECT_LE(result.gridObstacleCells, 4900); EXPECT_LE(result.gridObstacleCells, 4900);
#ifdef RTABMAP_OCTOMAP #ifdef RTABMAP_OCTOMAP
// Observed: empty 6072-7474, obstacle 39924-42883. Bounds are wide // Observed: empty 6072-8037, obstacle 39924-42883. Bounds are wide
// because without g2o (OdomF2M/BundleAdjustment disabled) visual // because without g2o (OdomF2M/BundleAdjustment disabled) visual
// odometry drifts a bit differently run-to-run, which propagates into // odometry drifts a bit differently run-to-run, which propagates into
// the assembled occupancy grid. // the assembled occupancy grid.
EXPECT_GE(result.octomapEmptyCells, 5500); EXPECT_GE(result.octomapEmptyCells, 5500);
EXPECT_LE(result.octomapEmptyCells, 8000); EXPECT_LE(result.octomapEmptyCells, 8500);
EXPECT_GE(result.octomapObstacleCells, 38000); EXPECT_GE(result.octomapObstacleCells, 38000);
EXPECT_LE(result.octomapObstacleCells, 44000); EXPECT_LE(result.octomapObstacleCells, 44000);
#endif #endif