Skip to content

test: Add basic test for cli module#74

Merged
Valentin-v-Todorov merged 2 commits intoTheDevOpsBlueprint:mainfrom
amcintosh:feature/add-tests-cli-module
Oct 9, 2025
Merged

test: Add basic test for cli module#74
Valentin-v-Todorov merged 2 commits intoTheDevOpsBlueprint:mainfrom
amcintosh:feature/add-tests-cli-module

Conversation

@amcintosh
Copy link
Contributor

@amcintosh amcintosh commented Oct 4, 2025

PR Checklist

  • Follows single-purpose principle
  • Tests pass locally (if applicable)
  • Documentation updated (if needed)

What does this PR do?

Add a test for the cli module. This does not provide much cli coverage yet, but given the recent breakage I figured it was worth getting a start of cli tests.

Coverage:

Name                       Stmts   Miss Branch BrPart  Cover
------------------------------------------------------------
alix/__init__.py               1      0      0      0   100%
alix/cli.py                  776    597    284      5    18%
alix/clipboard.py             66     66     16      0     0%
alix/config.py                31     14      2      1    55%
alix/history_manager.py      134    134     46      0     0%
alix/models.py                55      0     10      2    97%
alix/porter.py                96     36     42      5    59%
alix/render.py                66     54     40      1    12%
alix/scanner.py               45      0     16      0   100%
alix/shell_detector.py       111     79     68      3    22%
alix/shell_integrator.py     135    105     32      1    20%
alix/shell_wrapper.py         63     23     16      4    58%
alix/storage.py              114     23     34      1    74%
alix/tui.py                  412    412    112      0     0%
alix/usage_tracker.py         92     10     24      5    85%
------------------------------------------------------------
TOTAL                       2197   1553    742     28    26%

Related Issue

Fixes #29

Type of change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Configuration change
  • Documentation update
  • Setup/Infrastructure

Add a test for the cli module. This does not provide much cli coverage
yet, but given the recent breakage I figured it was worth getting a
start of cli tests.
Copy link
Contributor

@skalwaghe-56 skalwaghe-56 left a comment

Choose a reason for hiding this comment

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

I request you to add tests for logic! Not asserting messages. @Valentin-v-Todorov I think there is no need for tests which assert messages. We need tests which test actual logic!

@skalwaghe-56
Copy link
Contributor

I suggest you to add logic checks too! I have no problem with your current checks but you should add logic checks too! They are very important, and they should be more focused on.

@amcintosh amcintosh requested a review from skalwaghe-56 October 7, 2025 16:56
Copy link
Contributor

@skalwaghe-56 skalwaghe-56 left a comment

Choose a reason for hiding this comment

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

@amcintosh I can still see none logic checks. You can keep these output statements assetion logic there, but add core application logic checks. To check the actual application and not only the outputs. The current changes lgtm but please make the requested changes too. Thanks!

Comment on lines +42 to +47
assert "✔ Added alias: alix-test-echo = 'alix test working!'" in result.output
assert (
"💡 Alias 'alix-test-echo' is now available in new shell sessions"
in result.output
)
assert "For current session, run: source ~/.zshrc" in result.output
Copy link
Contributor

Choose a reason for hiding this comment

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

I see that you are still asserting the output messages only.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The assertions are on lines 38-41. These are unit tests so I'm confining the scope of the test to the code in the cli.py module. The logic underneath would be tested in test_storage.py and presumably a test_shell_integrator.py.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah that explains it.

Copy link
Contributor

@skalwaghe-56 skalwaghe-56 left a comment

Choose a reason for hiding this comment

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

LGTM

@Valentin-v-Todorov
Copy link
Contributor

@amcintosh LGTM!

Nice job!

@Valentin-v-Todorov Valentin-v-Todorov merged commit 25f42c9 into TheDevOpsBlueprint:main Oct 9, 2025
12 checks passed
@skalwaghe-56
Copy link
Contributor

@amcintosh Had you not run the tests locally? These are failing please fix them and open a new PR. Make sure they pass for now reverting these changes.

@amcintosh
Copy link
Contributor Author

@skalwaghe-56 I have run them all locally. I suspect it is due to other changes merged in. Hard to get test coverage up on a moving target.

@amcintosh
Copy link
Contributor Author

@skalwaghe-56, @Valentin-v-Todorov: PR to re-add here: #80

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.

Add comprehensive test suite

3 participants