Skip to content

Commit eb83aa3

Browse files
Bordalexierule
authored andcommitted
drop test_tracer_component_with_code
1 parent 6376b76 commit eb83aa3

File tree

1 file changed

+0
-53
lines changed

1 file changed

+0
-53
lines changed

tests/tests_app/components/python/test_python.py

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@
44
from tests_app import _PROJECT_ROOT
55

66
from lightning_app.components.python import PopenPythonScript, TracerPythonScript
7-
from lightning_app.components.python.tracer import Code
8-
from lightning_app.storage import Drive
97
from lightning_app.testing.helpers import RunIf
108
from lightning_app.testing.testing import run_work_isolated
11-
from lightning_app.utilities.component import _set_work_context
12-
from lightning_app.utilities.enum import CacheCallsKeys
13-
from lightning_app.utilities.packaging import tarfile
149

1510
COMPONENTS_SCRIPTS_FOLDER = str(os.path.join(_PROJECT_ROOT, "tests/tests_app/components/python/scripts/"))
1611

@@ -75,51 +70,3 @@ def test_tracer_python_script_with_kwargs():
7570
)
7671
run_work_isolated(python_script)
7772
assert python_script.has_failed
78-
79-
80-
def test_tracer_component_with_code():
81-
"""This test ensures the Tracer Component gets the latest code from the code object that is provided and
82-
arguments are cleaned."""
83-
84-
drive = Drive("lit://code")
85-
drive.component_name = "something"
86-
code = Code(drive=drive, name="sample.tar.gz")
87-
88-
with open("file.py", "w") as f:
89-
f.write('raise Exception("An error")')
90-
91-
with tarfile.open("sample.tar.gz", "w:gz") as tar:
92-
tar.add("file.py")
93-
94-
drive.put("sample.tar.gz")
95-
os.remove("file.py")
96-
os.remove("sample.tar.gz")
97-
98-
python_script = TracerPythonScript("file.py", script_args=["--b=1"], raise_exception=False, code=code)
99-
run_work_isolated(python_script, params={"a": "1"}, restart_count=0)
100-
assert python_script.status.message == "An error"
101-
102-
with open("file.py", "w") as f:
103-
f.write("import sys\n")
104-
f.write("print(sys.argv)\n")
105-
106-
with tarfile.open("sample.tar.gz", "w:gz") as tar:
107-
tar.add("file.py")
108-
109-
_set_work_context()
110-
drive.put("sample.tar.gz")
111-
os.remove("file.py")
112-
os.remove("sample.tar.gz")
113-
114-
with open("file.py", "w") as f:
115-
f.write('raise Exception("An error")')
116-
117-
call_hash = python_script._calls[CacheCallsKeys.LATEST_CALL_HASH]
118-
python_script._calls[call_hash]["statuses"].pop(-1)
119-
python_script._calls[call_hash]["statuses"].pop(-1)
120-
121-
run_work_isolated(python_script, params={"a": "1"}, restart_count=1)
122-
assert python_script.has_succeeded
123-
assert python_script.script_args == ["--b=1", "--a=1"]
124-
os.remove("file.py")
125-
os.remove("sample.tar.gz")

0 commit comments

Comments
 (0)