Skip to content

Commit 5691817

Browse files
authored
Merge pull request #348 from tony/fix-travis
Fix Travis CI
2 parents 4159cb1 + 6641368 commit 5691817

File tree

6 files changed

+53
-29
lines changed

6 files changed

+53
-29
lines changed

.coveragerc

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[run]
2+
branch = True
3+
source = tmuxp
24
omit =
35
tests/*
46
*/_vendor/*

.travis.yml

+19-17
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
language: python
2-
dist: precise
2+
dist: trusty
33
sudo: false
44
python:
55
- 2.7
6-
- 3.3
7-
- 3.4
8-
- 3.5
96
- 3.6
107
- pypy3.5-5.8.0
118
- pypy-5.6.0
129
env:
13-
- TMUX_VERSION=master
14-
- TMUX_VERSION=2.6
15-
- TMUX_VERSION=2.5
16-
- TMUX_VERSION=2.4
17-
- TMUX_VERSION=2.3
18-
- TMUX_VERSION=2.2
19-
- TMUX_VERSION=2.1
20-
- TMUX_VERSION=2.0
21-
- TMUX_VERSION=1.8
22-
- TMUX_VERSION=1.9a
10+
global:
11+
- RETRY_TIMEOUT_SECONDS=15
12+
matrix:
13+
- TMUX_VERSION=master
14+
- TMUX_VERSION=2.6
15+
- TMUX_VERSION=2.5
16+
- TMUX_VERSION=2.4
17+
- TMUX_VERSION=2.3
18+
- TMUX_VERSION=2.2
19+
- TMUX_VERSION=2.1
20+
- TMUX_VERSION=2.0
21+
- TMUX_VERSION=1.9a
22+
- TMUX_VERSION=1.8
2323
matrix:
2424
allow_failures:
2525
- env: TMUX_VERSION=master
26+
2627
before_install:
2728
- export PIP_USE_MIRRORS=true
2829
- pip install --upgrade pytest # https://github.com/travis-ci/travis-ci/issues/4873
2930
- pip install --upgrade pip wheel virtualenv setuptools
30-
- pip install coveralls
31+
- pip install pytest-cov coverage codecov
3132
install:
3233
- pip install -e .
34+
- pip install -r requirements/test.txt
3335
before_script:
3436
- git clone https://github.com/tmux/tmux.git tmux
3537
- cd tmux
@@ -39,11 +41,11 @@ before_script:
3941
- export PATH=$HOME/tmux/bin:$PATH
4042
- cd ..
4143
- tmux -V
42-
script: coverage run --source=tmuxp setup.py test
44+
script: py.test --cov
4345
addons:
4446
apt:
4547
packages:
4648
- libevent-dev
4749
- libncurses-dev
4850
after_success:
49-
- bash <(curl -s https://codecov.io/bash)
51+
- codecov

doc/developing.rst

+8
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,14 @@ tmuxp is tested against tmux 1.8 and the latest git source. Interpretters
187187
tested are 2.6, 2.7 and 3.3. The `travis build site`_ uses this
188188
`.travis.yml`_ configuration:
189189

190+
Testing options
191+
---------------
192+
193+
``RETRY_TIMEOUT_SECONDS`` can be toggled if certain workspace builder
194+
tests are being stubborn.
195+
196+
e.g. ``RETRY_TIMEOUT_SECONDS=10 py.test ``
197+
190198
.. literalinclude:: ../.travis.yml
191199
:language: yaml
192200

requirements/test.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pytest==3.4.1 # Updated from 3.0.4
2-
pytest-rerunfailures==4.0 # Updated from 2.0.1
1+
pytest==3.4.1
2+
pytest-rerunfailures==4.0

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ exclude = .*/,.tox,*.egg,tmuxp/_compat.py,tmuxp/__*__.py,
33
select = E,W,F,N
44

55
[tool:pytest]
6-
addopts = --rerun 5
6+
addopts = --reruns=5

tests/test_workspacebuilder.py

+21-9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
from .fixtures._util import loadfixture
2323

2424

25+
RETRY_TIMEOUT_SECONDS = int(os.getenv('RETRY_TIMEOUT_SECONDS', 8))
26+
27+
2528
def test_split_windows(session):
2629
yaml_config = loadfixture("workspacebuilder/two_pane.yaml")
2730
s = session
@@ -293,15 +296,17 @@ def test_window_options_after(session):
293296

294297
def assert_last_line(p, s):
295298
correct = False
296-
for _ in range(10):
299+
timeout = time.time() + RETRY_TIMEOUT_SECONDS # seconds timeout
300+
301+
while True:
297302
pane_out = p.cmd('capture-pane', '-p', '-J').stdout
298303
while not pane_out[-1].strip(): # delete trailing lines tmux 1.8
299304
pane_out.pop()
300305
if len(pane_out) > 1 and pane_out[-2].strip() == s:
301306
correct = True
302307
break
303-
304-
time.sleep(0.1)
308+
elif time.time() > timeout:
309+
break
305310

306311
# Print output for easier debugging if assertion fails
307312
if not correct:
@@ -390,31 +395,38 @@ def test_automatic_rename_option(session):
390395
assert s.name != 'tmuxp'
391396
w = s.windows[0]
392397

393-
for _ in range(10):
398+
timeout = time.time() + RETRY_TIMEOUT_SECONDS # seconds timeout
399+
while True:
394400
session.server._update_windows()
395401
if w.name != 'sh':
396402
break
397-
time.sleep(.2)
403+
elif time.time() > timeout:
404+
break
398405

399406
assert w.name != 'sh'
400407

401408
pane_base_index = w.show_window_option('pane-base-index', g=True)
402409
w.select_pane(pane_base_index)
403410

404-
for _ in range(10):
411+
timeout = time.time() + RETRY_TIMEOUT_SECONDS # seconds timeout
412+
while True:
405413
session.server._update_windows()
406414
if w.name == 'sh':
407415
break
408-
time.sleep(.3)
416+
elif time.time() > timeout:
417+
break
409418

410419
assert w.name == text_type('sh')
411420

412421
w.select_pane('-D')
413-
for _ in range(10):
422+
423+
timeout = time.time() + RETRY_TIMEOUT_SECONDS # seconds timeout
424+
while True:
414425
session.server._update_windows()
415426
if w['window_name'] != 'sh':
416427
break
417-
time.sleep(.2)
428+
elif time.time() > timeout:
429+
break
418430

419431
assert w.name != text_type('sh')
420432

0 commit comments

Comments
 (0)