mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-06 07:47:53 +10:00
wip
This commit is contained in:
@@ -67,56 +67,56 @@ def _extract_location_path(output: str, key: str) -> Path:
|
||||
def test_version_quiet_outputs_version_number(tmp_path):
|
||||
"""Test that version --quiet outputs just the version number."""
|
||||
os.chdir(tmp_path)
|
||||
result = subprocess.run(['archivebox', 'version', '--quiet'], capture_output=True, text=True)
|
||||
result = subprocess.run(["archivebox", "version", "--quiet"], capture_output=True, text=True)
|
||||
|
||||
assert result.returncode == 0
|
||||
version = result.stdout.strip()
|
||||
assert version
|
||||
# Version should be semver-ish format (e.g., 0.8.0)
|
||||
parts = version.split('.')
|
||||
parts = version.split(".")
|
||||
assert len(parts) >= 2
|
||||
|
||||
|
||||
def test_version_flag_outputs_version_number(tmp_path):
|
||||
"""Test that top-level --version reports the package version."""
|
||||
os.chdir(tmp_path)
|
||||
result = subprocess.run(['archivebox', '--version'], capture_output=True, text=True)
|
||||
result = subprocess.run(["archivebox", "--version"], capture_output=True, text=True)
|
||||
|
||||
assert result.returncode == 0
|
||||
version = result.stdout.strip()
|
||||
assert version
|
||||
assert len(version.split('.')) >= 2
|
||||
assert len(version.split(".")) >= 2
|
||||
|
||||
|
||||
def test_version_shows_system_info_in_initialized_dir(tmp_path, process):
|
||||
"""Test that version shows system metadata in initialized directory."""
|
||||
os.chdir(tmp_path)
|
||||
result = subprocess.run(['archivebox', 'version'], capture_output=True, text=True)
|
||||
result = subprocess.run(["archivebox", "version"], capture_output=True, text=True)
|
||||
|
||||
output = result.stdout
|
||||
assert 'ArchiveBox' in output
|
||||
assert "ArchiveBox" in output
|
||||
# Should show system info
|
||||
assert any(x in output for x in ['ARCH=', 'OS=', 'PYTHON='])
|
||||
assert any(x in output for x in ["ARCH=", "OS=", "PYTHON="])
|
||||
|
||||
|
||||
def test_version_shows_binaries_after_init(tmp_path, process):
|
||||
"""Test that version shows binary dependencies in initialized directory."""
|
||||
os.chdir(tmp_path)
|
||||
result = subprocess.run(['archivebox', 'version'], capture_output=True, text=True)
|
||||
result = subprocess.run(["archivebox", "version"], capture_output=True, text=True)
|
||||
|
||||
output = result.stdout
|
||||
# Should show binary section
|
||||
assert 'Binary' in output or 'Dependencies' in output
|
||||
assert "Binary" in output or "Dependencies" in output
|
||||
|
||||
|
||||
def test_version_shows_data_locations(tmp_path, process):
|
||||
"""Test that version shows data directory locations."""
|
||||
os.chdir(tmp_path)
|
||||
result = subprocess.run(['archivebox', 'version'], capture_output=True, text=True)
|
||||
result = subprocess.run(["archivebox", "version"], capture_output=True, text=True)
|
||||
|
||||
output = result.stdout
|
||||
# Should show paths
|
||||
assert any(x in output for x in ['Data', 'Code', 'location'])
|
||||
assert any(x in output for x in ["Data", "Code", "location"])
|
||||
|
||||
|
||||
def test_version_in_uninitialized_dir_still_works(tmp_path):
|
||||
@@ -125,7 +125,7 @@ def test_version_in_uninitialized_dir_still_works(tmp_path):
|
||||
empty_dir.mkdir()
|
||||
os.chdir(empty_dir)
|
||||
|
||||
result = subprocess.run(['archivebox', 'version', '--quiet'], capture_output=True, text=True)
|
||||
result = subprocess.run(["archivebox", "version", "--quiet"], capture_output=True, text=True)
|
||||
|
||||
# Should still output version
|
||||
assert result.returncode == 0
|
||||
@@ -164,15 +164,15 @@ def test_version_auto_selects_short_tmp_dir_for_deep_collection_path(tmp_path):
|
||||
def test_version_help_lists_quiet_flag(tmp_path):
|
||||
"""Test that version --help documents the quiet output mode."""
|
||||
os.chdir(tmp_path)
|
||||
result = subprocess.run(['archivebox', 'version', '--help'], capture_output=True, text=True)
|
||||
result = subprocess.run(["archivebox", "version", "--help"], capture_output=True, text=True)
|
||||
|
||||
assert result.returncode == 0
|
||||
assert '--quiet' in result.stdout or '-q' in result.stdout
|
||||
assert "--quiet" in result.stdout or "-q" in result.stdout
|
||||
|
||||
|
||||
def test_version_invalid_option_fails(tmp_path):
|
||||
"""Test that invalid version options fail cleanly."""
|
||||
os.chdir(tmp_path)
|
||||
result = subprocess.run(['archivebox', 'version', '--invalid-option'], capture_output=True, text=True)
|
||||
result = subprocess.run(["archivebox", "version", "--invalid-option"], capture_output=True, text=True)
|
||||
|
||||
assert result.returncode != 0
|
||||
|
||||
Reference in New Issue
Block a user