Repository navigation
🧪 Xircuits CLI Tests - #391
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements comprehensive testing for the Xircuits CLI, covering all major commands and features including initialization, compilation, execution, library management, and Jupyter integration. The test suite ensures reliability of the CLI interface across various usage scenarios.
The test suite was designed with isolation in mind - each test operates in its own temporary directory to prevent interference between tests. The framework includes a
run_commandhelper that handles process management, output verification, and cleanup.The tests use a combination of direct CLI command invocation and output/file verification to ensure the commands behave as expected. Several edge cases are covered, including error handling, re-initialization, and behavior in uninitialized directories.
The GitHub Actions workflow validates these tests automatically on pull requests to ensure ongoing reliability of the CLI interface.
References
N/A
Pull Request Type
Type of Change
Tests
This PR includes the following test cases for the Xircuits CLI:
1. Basic Command Tests
test_01_help_command- Testsxircuits --hshows help contenttest_02_alternative_help_command- Testsxircuits --helpshows help contenttest_03_init_command- Testsxircuits initcreates .xircuits and xai_components directories2. Core Functionality Tests
4.
test_04_compile_command- Testsxircuits compile file.xircuitsproperly generates Python code5.
test_05_run_command- Testsxircuits run file.xircuitscompiles and executes workflows6.
test_06_list_libraries_command- Testsxircuits listshows available component libraries7.
test_07_install_library_command- Testsxircuits install library_nameinstalls libraries8.
test_08_working_directory_detection- Tests CLI correctly detects Xircuits working directory9.
test_09_compile_with_custom_output- Testsxircuits compile file.xircuits output.pyuses custom output10.
test_10_error_handling_invalid_command- Testsxircuits invalid_commandgives appropriate error3. Library Management Tests
11.
test_11_install_invalid_library- Testsxircuits install non_existing_librarygives appropriate error12.
test_12_fetch_only_valid_library- Testsxircuits fetch-only library_namefetches without installing13.
test_13_install_already_installed_library- Tests reinstalling existing libraries4. Advanced Compilation Tests
14.
test_14_compile_invalid_xircuits- Tests error handling for compiling invalid Xircuits files15.
test_15_compile_with_python_paths_file- Tests--python-paths-fileoption for component paths16.
test_16_run_existing_py_file- Testsxircuits run file.pydirectly runs Python files17.
test_17_run_with_custom_output- Testsxircuits run file.xircuits output.pyuses custom output18.
test_18_run_invalid_xircuits- Testsxircuits run invalid.xircuitshandles errors appropriately19.
test_19_run_with_python_paths_file- Tests run command with component path specification20.
test_20_run_with_custom_arguments- Testsxircuits run file.xircuits -- --arg=valuepasses arguments5. Jupyterlab Integration Tests
21.
test_21_no_arguments_starts_jupyter_lab- Testsxircuitswith no args starts Jupyter Lab22.
test_22_start_command- Testsxircuits startlaunches JupyterLab23.
test_23_start_with_extra_arguments- Testsxircuits start --port=8899passes args to Jupyter6. Environment Management Tests
24.
test_24_auto_initialization- Tests initialization via XIRCUITS_INIT environment variable25.
test_25_reinit_in_already_initialized_directory- Tests reinitialization in existing directories26.
test_26_start_in_non_initialized_directory- Tests start behavior in non-initialized directories27.
test_27_xircuits_missing_xai_components- Tests behavior with missing xai_components7. Advanced Workflow Tests
28.
test_28_run_non_recursive_mode_with_install- Tests--non-recursiveflag for run command29.
test_29_compile_non_recursive_mode_with_install- Tests--non-recursiveflag for compile commandTo verify tests:
pytest -xvs test_xircuits_cli.pyTested on? Specify Version.
Notes
Thanks @rabea-al for finishing up the tests!