MCPcopy Create free account
hub / github.com/internetarchive/openlibrary / test_bash_run

Function test_bash_run

scripts/monitoring/tests/test_utils_sh.py:6–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4
5
6def test_bash_run():
7 # Test without sources
8 output = bash_run("echo 'Hello, World!'", capture_output=True)
9 assert output.stdout.strip() == "Hello, World!"
10
11 # Test with sources
12 with (
13 tempfile.NamedTemporaryFile(mode="w", delete_on_close=False) as source1,
14 tempfile.NamedTemporaryFile(mode="w", delete_on_close=False) as source2,
15 ):
16 source1.write("export VAR1=source1")
17 source2.write("export VAR2=source2")
18 source1.close()
19 source2.close()
20
21 output = bash_run(
22 "echo $VAR1 $VAR2",
23 sources=[source1.name, source2.name],
24 capture_output=True,
25 )
26 assert output.stdout.strip() == "source1 source2"
27
28
29def test_log_recent_bot_traffic():

Callers

nothing calls this directly

Calls 3

bash_runFunction · 0.90
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected