From f914460ae7930f33e0382bff37cd9107934aa143 Mon Sep 17 00:00:00 2001 From: Alice Sonolet Date: Mon, 27 Apr 2026 16:12:46 +0200 Subject: [PATCH 1/2] [tests] Fix test_submit when launched through a rez env --- tests/test_submit.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/test_submit.py b/tests/test_submit.py index d0ce9a77f8..b883237d9a 100644 --- a/tests/test_submit.py +++ b/tests/test_submit.py @@ -102,9 +102,16 @@ def processSubmit(node: Node, graph, tmp_path): class TestNodeSubmit: __test__ = IS_LINUX - + __env__ = {} + @classmethod def setup_class(cls): + cls.__env__ = {} + for var in ["REZ_REQUEST", "REZ_RESOLVE", "REZ_USED_REQUEST", "REZ_MESHROOM_VERSION"]: + if var in os.environ: + cls.__env__[var] = os.environ[var] + del os.environ[var] + # meshroom.core.initSubmitters() submitters = loadSubmitters(meshroomFolder, "submitters") for submitter in submitters: @@ -120,6 +127,9 @@ def setup_class(cls): @classmethod def teardown_class(cls): + for var, value in cls.__env__.items(): + os.environ[var] = value + for node in cls.plugin.nodes.values(): pluginManager.unregisterNode(node) pluginManager.removePlugin(cls.plugin) From 2b8435fe2917edc45d9d3eedd55b049f0e7bfba0 Mon Sep 17 00:00:00 2001 From: Alice Sonolet Date: Mon, 27 Apr 2026 16:19:26 +0200 Subject: [PATCH 2/2] Add possibility to disable rez in local farm and use it in tests --- meshroom/submitters/localFarmSubmitter.py | 13 ++++++++----- tests/test_submit.py | 13 ++----------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/meshroom/submitters/localFarmSubmitter.py b/meshroom/submitters/localFarmSubmitter.py index 14fb4c5747..c0c6a0e6da 100644 --- a/meshroom/submitters/localFarmSubmitter.py +++ b/meshroom/submitters/localFarmSubmitter.py @@ -204,6 +204,7 @@ class LocalFarmSubmitter(BaseSubmitter): dryRun = False environment = {} + disabled_rez = False def __init__(self, parent=None): super().__init__(parent=parent) @@ -235,13 +236,13 @@ def getChunks(chunkParams) -> list[Chunk]: it = [Chunk(i, item[0], item[-1]) for i, item in enumerate(slices) if i not in ignoreIterations] return it - @staticmethod - def getExpandWrappedCmd(cmdArgs, rezPackages): + def getExpandWrappedCmd(self, cmdArgs, rezPackages): # Wrap with create_chunks cmdBin = wrapMeshroomBin("meshroom_createChunks") cmd = f"{cmdBin} --submitter LocalFarm {cmdArgs}" # Wrap with rez - cmd = rezWrapCommand(cmd, otherRezPkg=rezPackages) + if not self.disabled_rez: + cmd = rezWrapCommand(cmd, otherRezPkg=rezPackages) return cmd def __createChunkTasks(self, job: Job, parentTask: Task, children: List[Task], chunkParams: dict) -> Task: @@ -253,7 +254,8 @@ def __createChunkTasks(self, job: Job, parentTask: Task, children: List[Task], c meta["iteration"] = c.iteration cmdBin = wrapMeshroomBin("meshroom_compute") cmd = f"{cmdBin} {cmdArgs} --iteration {c.iteration}" - cmd = rezWrapCommand(cmd, otherRezPkg=self.reqPackages) + if not self.disabled_rez: + cmd = rezWrapCommand(cmd, otherRezPkg=self.reqPackages) chunkTask = Task(name=name, command=cmd, metadata=meta, env=self.jobEnv) job.addTask(chunkTask) for child in children: @@ -286,7 +288,8 @@ def createTask(self, meshroomFile: str, node) -> CreatedTask: else: cmdBin = wrapMeshroomBin("meshroom_compute") cmd = f"{cmdBin} {cmdArgs} --iteration 0" - cmd = rezWrapCommand(cmd, otherRezPkg=self.reqPackages) + if not self.disabled_rez: + cmd = rezWrapCommand(cmd, otherRezPkg=self.reqPackages) task = Task(name=node.name, command=cmd, metadata=metadata, env=self.jobEnv) task = CreatedTask(task, None) diff --git a/tests/test_submit.py b/tests/test_submit.py index b883237d9a..77085e712c 100644 --- a/tests/test_submit.py +++ b/tests/test_submit.py @@ -76,6 +76,7 @@ def processSubmit(node: Node, graph, tmp_path): try: print(f"submit {node}") submitter = get_submitter() + submitter.disabled_rez = True submitter.setFarmPath(tmp_path) submitter.setJobEnv(getJobEnv()) nodesToProcess, edgesToProcess = [node], [] @@ -102,16 +103,9 @@ def processSubmit(node: Node, graph, tmp_path): class TestNodeSubmit: __test__ = IS_LINUX - __env__ = {} - + @classmethod def setup_class(cls): - cls.__env__ = {} - for var in ["REZ_REQUEST", "REZ_RESOLVE", "REZ_USED_REQUEST", "REZ_MESHROOM_VERSION"]: - if var in os.environ: - cls.__env__[var] = os.environ[var] - del os.environ[var] - # meshroom.core.initSubmitters() submitters = loadSubmitters(meshroomFolder, "submitters") for submitter in submitters: @@ -127,9 +121,6 @@ def setup_class(cls): @classmethod def teardown_class(cls): - for var, value in cls.__env__.items(): - os.environ[var] = value - for node in cls.plugin.nodes.values(): pluginManager.unregisterNode(node) pluginManager.removePlugin(cls.plugin)