Skip to content

Commit

Permalink
Merge pull request #13127 from KratosMultiphysics/core/hotfix-legacy-…
Browse files Browse the repository at this point in the history
…kratos-python

[Hotfix][Core] Fix legacy namespace exposure
  • Loading branch information
rubenzorrilla authored Feb 14, 2025
2 parents 536e51c + 23421b7 commit baf0eb4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion kratos/python/kratos_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ PYBIND11_MODULE(Kratos, m)
Future::Python::AddFutureToPython(future);
#endif

#ifdef KRATOS_USE_FUTURE
#ifdef KRATOS_USE_LEGACY
auto legacy = m.def_submodule("Legacy", "Kratos Legacy submodule containing legacy features");
Legacy::Python::AddLegacyToPython(legacy);
#endif
Expand Down
18 changes: 9 additions & 9 deletions kratos/tests/cpp_tests/sources/test_namespaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#ifdef KRATOS_USE_FUTURE
#include "future/processes/future_process.h"
#endif
#ifdef KRATOS_USE_FUTURE
#ifdef KRATOS_USE_LEGACY
#include "legacy/processes/legacy_process.h"
#endif

Expand All @@ -37,7 +37,7 @@ KRATOS_TEST_CASE_IN_SUITE(FutureProcess, KratosCoreFastSuite)
process.Execute(),
"I come from the future :)"
);
#else
#else
KRATOS_SUCCEED();
#endif
}
Expand All @@ -56,7 +56,7 @@ KRATOS_TEST_CASE_IN_SUITE(FutureProcessFromRegistry, KratosCoreFastSuite)
"I come from the future :)"
);
}
#else
#else
KRATOS_EXPECT_FALSE(Registry::HasItem("Processes.KratosMultiphysics.Future.Process"))
#endif
}
Expand All @@ -73,7 +73,7 @@ KRATOS_TEST_CASE_IN_SUITE(FutureProcessFromRegistryIsNotProcess, KratosCoreFastS
"Error: bad any_cast"
);
}
#else
#else
KRATOS_EXPECT_FALSE(Registry::HasItem("Processes.KratosMultiphysics.Future.Process"))
#endif
}
Expand All @@ -88,7 +88,7 @@ KRATOS_TEST_CASE_IN_SUITE(LegacyProcess, KratosCoreFastSuite)
process.Execute(),
"I... I don't feel well... My time has come, soon I will be unmade. Thank you for all the segmentation faults we lived together. :_)"
);
#else
#else
KRATOS_SUCCEED();
#endif
}
Expand All @@ -107,15 +107,15 @@ KRATOS_TEST_CASE_IN_SUITE(LegacyProcessFromRegistry, KratosCoreFastSuite)
"I... I don't feel well... My time has come, soon I will be unmade. Thank you for all the segmentation faults we lived together. :_)"
);
}
#else
#else
KRATOS_EXPECT_FALSE(Registry::HasItem("Processes.KratosMultiphysics.Legacy.Process"))
#endif
}

/* Test that the class in the registry is not the same class as its future / production counterpart */
KRATOS_TEST_CASE_IN_SUITE(LegacyProcessFromRegistryIsNotProcess, KratosCoreFastSuite)
{
#ifdef KRATOS_USE_FUTURE
#ifdef KRATOS_USE_LEGACY
KRATOS_EXPECT_TRUE(Registry::HasItem("Processes.KratosMultiphysics.Legacy.Process"))

if (Registry::HasItem("Processes.KratosMultiphysics.Legacy")) {
Expand All @@ -124,9 +124,9 @@ KRATOS_TEST_CASE_IN_SUITE(LegacyProcessFromRegistryIsNotProcess, KratosCoreFastS
"Error: bad any_cast"
);
}
#else
#else
KRATOS_EXPECT_FALSE(Registry::HasItem("Processes.KratosMultiphysics.Legacy.Process"))
#endif
}

} // Kratos::Testing namespace
} // Kratos::Testing namespace

0 comments on commit baf0eb4

Please sign in to comment.