Skip to content

Commit 614bbb2

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

2 files changed

Lines changed: 5 additions & 19 deletions

File tree

.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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ 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(not clipboard_available(), reason="Clipboard not available (no display or clipboard tool)")
167168
def test_copy_suppresses_stdout(self, temp_project):
168169
result = run_treemapper_subprocess([".", "-c"], cwd=temp_project)
169170
assert result.returncode == 0
@@ -207,6 +208,7 @@ def test_explicit_stdout_without_copy(self, temp_project):
207208
assert result.stdout != ""
208209
assert "file.txt" in result.stdout
209210

211+
@pytest.mark.skipif(not clipboard_available(), reason="Clipboard not available (no display or clipboard tool)")
210212
def test_copy_without_explicit_stdout_suppresses_output(self, temp_project):
211213
"""Test that -c without -o - suppresses stdout when clipboard succeeds."""
212214
result = run_treemapper_subprocess([".", "-c"], cwd=temp_project)

0 commit comments

Comments
 (0)