From d2841ac78f9b50e65adf44124dc49514ce7b3c7b Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 3 Mar 2018 14:56:39 -0600 Subject: [PATCH 01/13] update travis to trusty --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 54638cce389..3cb4969f909 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: python -dist: precise +dist: trusty sudo: false python: - 2.7 From 7b7a993e41515757ea2f48f0abe440e46566b617 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 3 Mar 2018 14:57:28 -0600 Subject: [PATCH 02/13] rm python testing from older 3 versions for speed --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3cb4969f909..3c21aba241a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,6 @@ dist: trusty sudo: false python: - 2.7 - - 3.3 - - 3.4 - - 3.5 - 3.6 - pypy3.5-5.8.0 - pypy-5.6.0 From a5a54f5137301e161b8af7f237e815f3d6f27cdc Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 3 Mar 2018 14:57:45 -0600 Subject: [PATCH 03/13] move 1.9a up --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3c21aba241a..01fa2a1c51e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,8 @@ env: - TMUX_VERSION=2.2 - TMUX_VERSION=2.1 - TMUX_VERSION=2.0 - - TMUX_VERSION=1.8 - TMUX_VERSION=1.9a + - TMUX_VERSION=1.8 matrix: allow_failures: - env: TMUX_VERSION=master From fe62deea39dc63cef7762c9976a2972847ee60a4 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 3 Mar 2018 15:09:14 -0600 Subject: [PATCH 04/13] rm comments from requirements/test --- requirements/test.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements/test.txt b/requirements/test.txt index b41dff1365d..2c9d71008a3 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -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 From 669aa3d7256af6f38ced075925eec144a6abe114 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 3 Mar 2018 15:11:42 -0600 Subject: [PATCH 05/13] update codecov to new example format see: https://github.com/codecov/codecov-python/blob/a1ffe5a/.travis.yml --- .coveragerc | 2 ++ .travis.yml | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.coveragerc b/.coveragerc index 2784a20bef0..dd73cf40030 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,4 +1,6 @@ [run] +branch = True +source = tmuxp omit = tests/* */_vendor/* diff --git a/.travis.yml b/.travis.yml index 01fa2a1c51e..fcc7a0765eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,11 +20,12 @@ env: 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 python-coverage install: - pip install -e . before_script: @@ -36,11 +37,11 @@ before_script: - export PATH=$HOME/tmux/bin:$PATH - cd .. - tmux -V -script: coverage run --source=tmuxp setup.py test +script: py.test --cov=codecov addons: apt: packages: - libevent-dev - libncurses-dev after_success: - - bash <(curl -s https://codecov.io/bash) + - codecov From c9ce2239ff77fdb8f7745fb3e6b744d0d96cf287 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 3 Mar 2018 15:12:45 -0600 Subject: [PATCH 06/13] update reruns pytest flag fixes error message: error: ambiguous option: --rerun could match --reruns, --reruns-delay --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 615899d1dec..3aa7166ef65 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 From fba78804df7fa5723d0cf3162fd694296706dee8 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 3 Mar 2018 15:19:40 -0600 Subject: [PATCH 07/13] fix typo in package name --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fcc7a0765eb..4c9b6c2bfce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ 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 pytest-cov python-coverage + - pip install pytest-cov coverage install: - pip install -e . before_script: From 905e549b5f859cc9a0f1d4562bfc79589ca4207b Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 3 Mar 2018 15:33:38 -0600 Subject: [PATCH 08/13] try to get reruns to work in travis --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 3aa7166ef65..9cda12e03c3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,4 +3,4 @@ exclude = .*/,.tox,*.egg,tmuxp/_compat.py,tmuxp/__*__.py, select = E,W,F,N [tool:pytest] -addopts = --reruns 5 +addopts = --reruns=5 From a517edfaafce57c31458904b6aef82020b79f775 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 3 Mar 2018 15:45:58 -0600 Subject: [PATCH 09/13] install test requirements --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 4c9b6c2bfce..ef7bc5af6b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,6 +28,7 @@ before_install: - pip install pytest-cov coverage install: - pip install -e . + - pip install -r requirements/test.txt before_script: - git clone https://github.com/tmux/tmux.git tmux - cd tmux From 8fd410ad31f85ffa98d5bbcbf2229e732d9594a2 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 3 Mar 2018 16:35:18 -0600 Subject: [PATCH 10/13] try to improve reliability of test_window_options_after in CI --- tests/test_workspacebuilder.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_workspacebuilder.py b/tests/test_workspacebuilder.py index 97ea40e955e..ae903c07d75 100644 --- a/tests/test_workspacebuilder.py +++ b/tests/test_workspacebuilder.py @@ -293,15 +293,16 @@ def test_window_options_after(session): def assert_last_line(p, s): correct = False - for _ in range(10): + timeout = time.time() + 5 # 5 second 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: From d11b720767b98d667d544571825866260d4ad26d Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 3 Mar 2018 17:57:26 -0600 Subject: [PATCH 11/13] add codecov to travis before_install, fix --cov argument --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ef7bc5af6b9..1a2be5a9f6f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ 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 pytest-cov coverage + - pip install pytest-cov coverage codecov install: - pip install -e . - pip install -r requirements/test.txt @@ -38,7 +38,7 @@ before_script: - export PATH=$HOME/tmux/bin:$PATH - cd .. - tmux -V -script: py.test --cov=codecov +script: py.test --cov addons: apt: packages: From 71c68a9912a45a7888d49ce0846d55b34383ca27 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 3 Mar 2018 18:26:19 -0600 Subject: [PATCH 12/13] improve reliability of stubborn tests add RETRY_TIMEOUT_SECONDS setting, with default of 8 seconds for now it can be configured via environmental variables, add docs. --- doc/developing.rst | 8 ++++++++ tests/test_workspacebuilder.py | 25 ++++++++++++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/doc/developing.rst b/doc/developing.rst index 9c8f58c7e80..55def7bfbc3 100644 --- a/doc/developing.rst +++ b/doc/developing.rst @@ -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 diff --git a/tests/test_workspacebuilder.py b/tests/test_workspacebuilder.py index ae903c07d75..2a3d234e39e 100644 --- a/tests/test_workspacebuilder.py +++ b/tests/test_workspacebuilder.py @@ -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 @@ -293,7 +296,8 @@ def test_window_options_after(session): def assert_last_line(p, s): correct = False - timeout = time.time() + 5 # 5 second timeout + 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 @@ -391,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') From 66413687f00bb9ba71126cea5f826106492b7b97 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 3 Mar 2018 19:30:23 -0600 Subject: [PATCH 13/13] set RETRY_TIMEOUT_SECONDS to 15 in travis --- .travis.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1a2be5a9f6f..0fb0d3480f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,16 +7,19 @@ python: - 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.9a - - TMUX_VERSION=1.8 + 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