* refactor: remove unused imports * fix: replace NotImplemented with NotImplementedError * refactor: resolve E722 (do not use bare 'except') * refactor: remove unused variable * refactor: remove unused imports * refactor: ignore unused imports that will be used in the future * refactor: resolve W293 (blank line contains whitespace) * refactor: resolve F541 (f-string is missing placeholders) --------- Co-authored-by: afourney <adamfo@microsoft.com>
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
#!/usr/bin/env python3 -m pytest
|
|
import subprocess
|
|
from markitdown import __version__
|
|
|
|
# This file contains CLI tests that are not directly tested by the FileTestVectors.
|
|
# This includes things like help messages, version numbers, and invalid flags.
|
|
|
|
|
|
def test_version() -> None:
|
|
result = subprocess.run(
|
|
["python", "-m", "markitdown", "--version"], capture_output=True, text=True
|
|
)
|
|
|
|
assert result.returncode == 0, f"CLI exited with error: {result.stderr}"
|
|
assert __version__ in result.stdout, f"Version not found in output: {result.stdout}"
|
|
|
|
|
|
def test_invalid_flag() -> None:
|
|
result = subprocess.run(
|
|
["python", "-m", "markitdown", "--foobar"], capture_output=True, text=True
|
|
)
|
|
|
|
assert result.returncode != 0, f"CLI exited with error: {result.stderr}"
|
|
assert (
|
|
"unrecognized arguments" in result.stderr
|
|
), "Expected 'unrecognized arguments' to appear in STDERR"
|
|
assert "SYNTAX" in result.stderr, "Expected 'SYNTAX' to appear in STDERR"
|
|
|
|
|
|
if __name__ == "__main__":
|
|
"""Runs this file's tests from the command line."""
|
|
test_version()
|
|
test_invalid_flag()
|
|
print("All tests passed!")
|