Skip to content

Commit a0b6dbc

Browse files
committed
Updates tests
1 parent e6c736b commit a0b6dbc

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,5 @@ cython_debug/
141141
.idea
142142
src/pytailwindcss/bin
143143
src/tests/build
144+
.claude
145+
.history

tests/test_installation.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os.path
22
import platform
3+
import subprocess
34

45
import pytailwindcss
56
from pytailwindcss.installation import detect_target, format_target
@@ -74,3 +75,43 @@ def test_format_target_uppercase_arch():
7475
assert format_target("linux", "X86_64") == "linux-x64"
7576
assert format_target("linux", "AMD64") == "linux-x64"
7677
assert format_target("linux", "AARCH64") == "linux-arm64"
78+
79+
80+
def test_cli_install_command_with_version():
81+
"""
82+
It runs the 'tailwindcss_install' CLI command with TAILWINDCSS_VERSION set
83+
and verifies the correct version binary is installed.
84+
"""
85+
test_version = "v4.0.5"
86+
expected_bin_path = get_bin_path(test_version)
87+
88+
with clean_dir(expected_bin_path):
89+
# Run the actual CLI command with environment variable
90+
env = os.environ.copy()
91+
env["TAILWINDCSS_VERSION"] = test_version
92+
result = subprocess.run(["tailwindcss_install"], env=env, capture_output=True, text=True)
93+
94+
assert result.returncode == 0, f"CLI command failed with: {result.stderr}"
95+
assert os.path.isfile(expected_bin_path), f"Binary not installed at {expected_bin_path}"
96+
97+
# Verify the correct version was installed
98+
version_check = pytailwindcss.run(version=test_version)
99+
assert "4.0.5" in version_check, f"Expected v4.0.5, got: {version_check}"
100+
101+
102+
def test_cli_install_command_without_version():
103+
"""
104+
It runs the 'tailwindcss_install' CLI command without TAILWINDCSS_VERSION
105+
and verifies the 'latest' version binary is installed.
106+
"""
107+
expected_bin_path = get_bin_path("latest")
108+
109+
with clean_dir(expected_bin_path):
110+
# Run the actual CLI command without TAILWINDCSS_VERSION
111+
env = os.environ.copy()
112+
# Remove TAILWINDCSS_VERSION if it exists
113+
env.pop("TAILWINDCSS_VERSION", None)
114+
result = subprocess.run(["tailwindcss_install"], env=env, capture_output=True, text=True)
115+
116+
assert result.returncode == 0, f"CLI command failed with: {result.stderr}"
117+
assert os.path.isfile(expected_bin_path), f"Binary not installed at {expected_bin_path}"

0 commit comments

Comments
 (0)