-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from Bchass/pytest_conversion
test conversion
- Loading branch information
Showing
1 changed file
with
17 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
import unittest | ||
import pytest | ||
import subprocess | ||
|
||
class TestCLIVersion(unittest.TestCase): | ||
|
||
def test_version_option(self): | ||
|
||
@pytest.fixture | ||
def run_cli_command(): | ||
# This fixture runs the CLI command and captures its output | ||
def run_command(): | ||
# Run the CLI command and capture its output | ||
result = subprocess.run(["python", "-m", "src.interviewkit.cli", "version"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) | ||
return result | ||
|
||
return run_command | ||
|
||
self.assertEqual(result.returncode, 0) | ||
|
||
# Check if the version number is correct | ||
self.assertIn(f"HistoryAIToolKit: 0.0.1", result.stdout) | ||
class TestCLIVersion(): | ||
|
||
def test_version_option(self, run_cli_command): | ||
result = run_cli_command() | ||
|
||
assert result.returncode == 0 | ||
|
||
if __name__ == '__main__': | ||
unittest.main() | ||
# Check if the version number is correct | ||
assert f"HistoryAIToolKit: 0.0.1" in result.stdout |