Skip to content

Fix Travis CI #348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Mar 4, 2018
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[run]
branch = True
source = tmuxp
omit =
tests/*
*/_vendor/*
Expand Down
36 changes: 19 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
language: python
dist: precise
dist: trusty
sudo: false
python:
- 2.7
- 3.3
- 3.4
- 3.5
- 3.6
- pypy3.5-5.8.0
- pypy-5.6.0
env:
- TMUX_VERSION=master
- TMUX_VERSION=2.6
- TMUX_VERSION=2.5
- TMUX_VERSION=2.4
- TMUX_VERSION=2.3
- TMUX_VERSION=2.2
- TMUX_VERSION=2.1
- TMUX_VERSION=2.0
- TMUX_VERSION=1.8
- TMUX_VERSION=1.9a
global:
- RETRY_TIMEOUT_SECONDS=15
matrix:
- TMUX_VERSION=master
- TMUX_VERSION=2.6
- TMUX_VERSION=2.5
- TMUX_VERSION=2.4
- TMUX_VERSION=2.3
- TMUX_VERSION=2.2
- TMUX_VERSION=2.1
- TMUX_VERSION=2.0
- TMUX_VERSION=1.9a
- TMUX_VERSION=1.8
matrix:
allow_failures:
- env: TMUX_VERSION=master

before_install:
- export PIP_USE_MIRRORS=true
- pip install --upgrade pytest # https://github.com/travis-ci/travis-ci/issues/4873
- pip install --upgrade pip wheel virtualenv setuptools
- pip install coveralls
- pip install pytest-cov coverage codecov
install:
- pip install -e .
- pip install -r requirements/test.txt
before_script:
- git clone https://github.com/tmux/tmux.git tmux
- cd tmux
Expand All @@ -39,11 +41,11 @@ before_script:
- export PATH=$HOME/tmux/bin:$PATH
- cd ..
- tmux -V
script: coverage run --source=tmuxp setup.py test
script: py.test --cov
addons:
apt:
packages:
- libevent-dev
- libncurses-dev
after_success:
- bash <(curl -s https://codecov.io/bash)
- codecov
8 changes: 8 additions & 0 deletions doc/developing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ tmuxp is tested against tmux 1.8 and the latest git source. Interpretters
tested are 2.6, 2.7 and 3.3. The `travis build site`_ uses this
`.travis.yml`_ configuration:

Testing options
---------------

``RETRY_TIMEOUT_SECONDS`` can be toggled if certain workspace builder
tests are being stubborn.

e.g. ``RETRY_TIMEOUT_SECONDS=10 py.test ``

.. literalinclude:: ../.travis.yml
:language: yaml

Expand Down
4 changes: 2 additions & 2 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pytest==3.4.1 # Updated from 3.0.4
pytest-rerunfailures==4.0 # Updated from 2.0.1
pytest==3.4.1
pytest-rerunfailures==4.0
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ exclude = .*/,.tox,*.egg,tmuxp/_compat.py,tmuxp/__*__.py,
select = E,W,F,N

[tool:pytest]
addopts = --rerun 5
addopts = --reruns=5
30 changes: 21 additions & 9 deletions tests/test_workspacebuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
from .fixtures._util import loadfixture


RETRY_TIMEOUT_SECONDS = int(os.getenv('RETRY_TIMEOUT_SECONDS', 8))


def test_split_windows(session):
yaml_config = loadfixture("workspacebuilder/two_pane.yaml")
s = session
Expand Down Expand Up @@ -293,15 +296,17 @@ def test_window_options_after(session):

def assert_last_line(p, s):
correct = False
for _ in range(10):
timeout = time.time() + RETRY_TIMEOUT_SECONDS # seconds timeout

while True:
pane_out = p.cmd('capture-pane', '-p', '-J').stdout
while not pane_out[-1].strip(): # delete trailing lines tmux 1.8
pane_out.pop()
if len(pane_out) > 1 and pane_out[-2].strip() == s:
correct = True
break

time.sleep(0.1)
elif time.time() > timeout:
break

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

for _ in range(10):
timeout = time.time() + RETRY_TIMEOUT_SECONDS # seconds timeout
while True:
session.server._update_windows()
if w.name != 'sh':
break
time.sleep(.2)
elif time.time() > timeout:
break

assert w.name != 'sh'

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

for _ in range(10):
timeout = time.time() + RETRY_TIMEOUT_SECONDS # seconds timeout
while True:
session.server._update_windows()
if w.name == 'sh':
break
time.sleep(.3)
elif time.time() > timeout:
break

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

w.select_pane('-D')
for _ in range(10):

timeout = time.time() + RETRY_TIMEOUT_SECONDS # seconds timeout
while True:
session.server._update_windows()
if w['window_name'] != 'sh':
break
time.sleep(.2)
elif time.time() > timeout:
break

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

Expand Down