mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-11-13 03:37:15 +00:00
The test is parametrized over gateway types; it imports "remote" from its tmp_path and then deletes that directory, but the module stays in sys.modules. Every run after the first got the stale module back and failed with "OSError: could not get source code". Drop the cached module before importing it. AI-Generated: Uses Claude Code Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
39 lines
1.4 KiB
Diff
39 lines
1.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Khem Raj <raj.khem@gmail.com>
|
|
Date: Wed, 4 Nov 2026 16:22:44 -0800
|
|
Subject: [PATCH] testing: Drop cached remote module in
|
|
test_remote_exec_module_is_removed
|
|
|
|
test_remote_exec_module_is_removed is parametrized over the gateway
|
|
fixtures. The first run imports "remote" from its tmp_path and then
|
|
removes that directory, but the module stays in sys.modules. Later
|
|
runs then get the stale module back from "import remote", whose source
|
|
file is gone, and remote_exec() fails with:
|
|
|
|
OSError: could not get source code
|
|
|
|
Remove "remote" from sys.modules before importing it, so each run
|
|
imports the module it just wrote.
|
|
|
|
Upstream-Status: Submitted [https://github.com/pytest-dev/execnet/pull/442]
|
|
|
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
|
---
|
|
testing/test_gateway.py | 3 +++
|
|
1 file changed, 3 insertions(+)
|
|
|
|
diff --git a/testing/test_gateway.py b/testing/test_gateway.py
|
|
index 634f237..c571bbd 100644
|
|
--- a/testing/test_gateway.py
|
|
+++ b/testing/test_gateway.py
|
|
@@ -130,6 +130,9 @@ class TestBasicGateway:
|
|
)
|
|
|
|
monkeypatch.syspath_prepend(tmp_path)
|
|
+ # The test is parametrized; drop the module cached by a previous run,
|
|
+ # whose source file has since been removed.
|
|
+ monkeypatch.delitem(sys.modules, "remote", raising=False)
|
|
import remote # type: ignore[import-not-found]
|
|
|
|
ch = gw.remote_exec(remote)
|