Skip to content

Commit 0db0b2d

Browse files
committed
fix: skip clipboard tests when no display available
1 parent 2d3feb4 commit 0db0b2d

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,11 @@ jobs:
114114
python -m pip install --upgrade pip
115115
pip install -e .[dev]
116116
117-
- name: Install clipboard tools (Linux)
118-
if: runner.os == 'Linux'
119-
run: |
120-
sudo apt-get update
121-
sudo apt-get install -y xvfb xclip
122-
123117
- name: Run Tests with Coverage
124118
shell: bash
125119
run: |
126-
if [ "$RUNNER_OS" = "Linux" ]; then
127-
xvfb-run pytest -v --cov=src/treemapper --cov-report=xml \
128-
--cov-report=term-missing --cov-branch --junitxml=test-results.xml
129-
else
130-
pytest -v --cov=src/treemapper --cov-report=xml \
131-
--cov-report=term-missing --cov-branch --junitxml=test-results.xml
132-
fi
120+
pytest -v --cov=src/treemapper --cov-report=xml \
121+
--cov-report=term-missing --cov-branch --junitxml=test-results.xml
133122
134123
- name: Coverage report with threshold
135124
if: runner.os == 'Linux' && matrix.python-version == '3.12'
@@ -190,14 +179,9 @@ jobs:
190179
pip install -e .
191180
pip install pytest pytest-cov
192181
193-
- name: Install clipboard tools (Linux)
194-
run: |
195-
sudo apt-get update
196-
sudo apt-get install -y xvfb xclip
197-
198182
- name: Run Tests
199183
run: |
200-
xvfb-run pytest -v
184+
pytest -v
201185
202186
# ============================================================================
203187
# Mutation Testing (test effectiveness validation)

tests/test_clipboard.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ def test_copy_flag_accepted(self, temp_project):
164164
result = run_treemapper_subprocess([".", "-c"], cwd=temp_project)
165165
assert result.returncode == 0
166166

167+
@pytest.mark.skipif(
168+
not clipboard_available(),
169+
reason="Clipboard not available (no display or clipboard tool)"
170+
)
167171
def test_copy_suppresses_stdout(self, temp_project):
168172
result = run_treemapper_subprocess([".", "-c"], cwd=temp_project)
169173
assert result.returncode == 0
@@ -207,6 +211,10 @@ def test_explicit_stdout_without_copy(self, temp_project):
207211
assert result.stdout != ""
208212
assert "file.txt" in result.stdout
209213

214+
@pytest.mark.skipif(
215+
not clipboard_available(),
216+
reason="Clipboard not available (no display or clipboard tool)"
217+
)
210218
def test_copy_without_explicit_stdout_suppresses_output(self, temp_project):
211219
"""Test that -c without -o - suppresses stdout when clipboard succeeds."""
212220
result = run_treemapper_subprocess([".", "-c"], cwd=temp_project)

0 commit comments

Comments
 (0)