Skip to content

Commit 0d766f5

Browse files
committed
Remove script-testing unit-tests
1 parent 4290b74 commit 0d766f5

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

tests/benchmark/test_validate_mocks.py

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -427,47 +427,3 @@ def test_main_rails_failed(self, mock_check_endpoint, mock_check_rails_endpoint)
427427
main()
428428

429429
assert exc_info.value.code == 1
430-
431-
432-
class TestScriptExecution:
433-
"""Test the script can be executed directly."""
434-
435-
def test_script_execution(self):
436-
"""Test that the script can be executed via __main__."""
437-
# Import the module to trigger __main__ block if run directly
438-
import importlib
439-
440-
import nemoguardrails.benchmark.validate_mocks as vm_module
441-
442-
# Reload to ensure __main__ block is checked
443-
importlib.reload(vm_module)
444-
445-
# If we're not running as __main__, the main function shouldn't be called
446-
# This test verifies the module can be imported without issues
447-
assert callable(vm_module.check_endpoint)
448-
assert callable(vm_module.check_rails_endpoint)
449-
assert callable(vm_module.main)
450-
451-
@patch("nemoguardrails.benchmark.validate_mocks.check_rails_endpoint")
452-
@patch("nemoguardrails.benchmark.validate_mocks.check_endpoint")
453-
def test_script_can_run_as_main(
454-
self, mock_check_endpoint, mock_check_rails_endpoint
455-
):
456-
"""Test that the script can run when invoked as main."""
457-
mock_check_endpoint.side_effect = [
458-
(True, "Port 8000: PASSED"),
459-
(True, "Port 8001: PASSED"),
460-
]
461-
mock_check_rails_endpoint.return_value = (True, "Port 9000: PASSED")
462-
463-
# This simulates running the script directly
464-
script_path = "/Users/tgasser/projects/nemo_guardrails/nemoguardrails/benchmark/validate_mocks.py"
465-
with pytest.raises(SystemExit) as exc_info:
466-
with open(script_path, encoding="utf-8") as f:
467-
# Using exec to simulate script execution is necessary for testing __main__ block
468-
exec(
469-
compile(f.read(), "validate_mocks.py", "exec"),
470-
{"__name__": "__main__"},
471-
) # noqa: S102
472-
473-
assert exc_info.value.code == 0

0 commit comments

Comments
 (0)