Skip to content

Add new tests - #390

Merged
MFA-X-AI merged 4 commits into
XpressAI:fahreza/cli-testsfrom
rabea-al:fahreza/cli-tests
Mar 31, 2025
Merged

MFA-X-AI merged 4 commits into
XpressAI:fahreza/cli-testsfrom
rabea-al:fahreza/cli-tests

Conversation

@rabea-al

@rabea-al rabea-al commented Mar 21, 2025 •

Copy link
Copy Markdown
Contributor

Description

This PR introduces a new set of CLI test cases under tests/tests.py to improve the test coverage of core functionalities.
Additionally, a new GitHub Actions workflow file run-cli-tests.yml was added under .github/workflows/ to automate running these tests.

The goal is to ensure CLI components behave as expected and are tested on every push, pull request, or manual dispatch across multiple Python versions.


This PR also fixes an issue where installed libraries were incorrectly marked as incomplete ([*]) when listed using xircuits list, despite being properly installed.

The issue occurred because the check_requirements_installed function was comparing the full requirement string (e.g., "sendgrid==6.11.0") with the list of installed package names obtained from pip freeze (e.g., "sendgrid"), which does not include version information.

To fix this:

  • The comparison logic has been updated to extract only the package name (before ==) from the requirements list.
  • This ensures that if the package is installed, the library will be correctly marked as installed, preventing the [ * ] marker from appearing.

Pull Request Type

  • Xircuits Core (Jupyterlab Related changes)
  • Xircuits Canvas (Custom RD Related changes)
  • Xircuits Component Library
  • Xircuits Project Template
  • Testing Automation
  • Documentation
  • Others (Please Specify)

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Test

  1. Clone the repository
  2. Ensure dependencies are installed (preferably in a virtual environment):
    pip install -e .
  3. Run the tests manually:
    pytest -v tests/tests.py
  4. Alternatively, push to a branch or open a PR to trigger the GitHub Action:
    • The workflow will automatically test on Python 3.8, 3.9, 3.10, and 3.11.
    • You can also dispatch it manually from the Actions tab.

Tested On

  • Windows
  • Linux (Fedora)
  • macOS
  • Others: N/A

@github-actions

Copy link
Copy Markdown

Binder 👈 Launch a binder notebook on branch rabea-al/xircuits/fahreza/cli-tests

@MFA-X-AI MFA-X-AI left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!
I'll review the codebase in a bit, but before I forget - typically in the PR message we would want to keep it more verbose on what it does and why, just so future people who are looking at the code base can understand.
As for the test sections, it should be instructions on how to test your PR.

@MFA-X-AI MFA-X-AI left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! You're really helping me save time by polishing these tests.
I've added my comments on what to update, but overall it looks good and I can confirm that the current tests run until the end.
One additional thing I'd like to request is a test to ensure that xircuits install github_url works properly. Lemme know how that works out.

Comment thread tests/tests.py Resolved
Comment thread tests/tests.py Resolved
Comment thread tests/tests.py
assert output_file.exists(), f"Expected output file '{output_file}' not found."


def test_interrupted_initialization():

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure which test this refers to.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is related to test number 32 in the spreadsheet.

Comment thread tests/tests.py Resolved
Comment thread tests/tests.py Resolved
Comment thread tests/tests.py Resolved
@MFA-X-AI

Copy link
Copy Markdown
Member

LGTM!
Thanks for the changes. I'll merge this so we can test the github action.

@MFA-X-AI
MFA-X-AI merged commit 3417131 into XpressAI:fahreza/cli-tests Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants