From 03765db6832b7bda73ac1cf115ce893d605eb541 Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Thu, 5 Nov 2015 23:14:05 +0800 Subject: [PATCH 1/3] Make test_gitcafe flaky --- .travis.yml | 4 ++-- setup.py | 2 ++ tests/test_gitcafe.py | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d9daa5c..b2ccf98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,8 @@ language: python python: - "3.4" - "3.5" -install: pip install . -script: py.test +install: pip install pytest-runner +script: python setup.py ptr env: global: - ASYNC_TEST_TIMEOUT=20 diff --git a/setup.py b/setup.py index 904043f..9ba8b29 100755 --- a/setup.py +++ b/setup.py @@ -11,6 +11,8 @@ setup( install_requires = ['tornado>=4.1', 'setuptools'], tests_require=[ 'pytest', + 'flaky', + 'pytest-runner', ], entry_points = { 'console_scripts': [ diff --git a/tests/test_gitcafe.py b/tests/test_gitcafe.py index 2d74a93..cfa601a 100644 --- a/tests/test_gitcafe.py +++ b/tests/test_gitcafe.py @@ -1,6 +1,8 @@ +from flaky import flaky from tests.helper import ExternalVersionTestCase class GitCafeTest(ExternalVersionTestCase): + @flaky(max_runs=3) def test_gitcafe(self): self.assertEqual(self.sync_get_version("example", {"gitcafe": "test/test"}), "20120201") From b8987edaff12bedf2732fa636e7df08a0e09c103 Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Thu, 5 Nov 2015 23:23:21 +0800 Subject: [PATCH 2/3] Skip github tests if NVCHECKER_GITHUB_TOKEN not present --- tests/test_github.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_github.py b/tests/test_github.py index 160bed6..a3e8ffb 100644 --- a/tests/test_github.py +++ b/tests/test_github.py @@ -1,6 +1,10 @@ +import os +import pytest from tests.helper import ExternalVersionTestCase +@pytest.mark.skipif("NVCHECKER_GITHUB_TOKEN" not in os.environ, + reason="requires NVCHECKER_GITHUB_TOKEN, or it fails too much") class GitHubTest(ExternalVersionTestCase): def test_github(self): self.assertEqual(self.sync_get_version("example", {"github": "harry-sanabria/ReleaseTestRepo"}), "20140122") From a9fb82b03c07e08961a1193fd87b20fffd25aba0 Mon Sep 17 00:00:00 2001 From: Felix Yan Date: Thu, 5 Nov 2015 23:33:03 +0800 Subject: [PATCH 3/3] Actually pytest-runner need not to be in tests_require --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 9ba8b29..0a42c6b 100755 --- a/setup.py +++ b/setup.py @@ -12,7 +12,6 @@ setup( tests_require=[ 'pytest', 'flaky', - 'pytest-runner', ], entry_points = { 'console_scripts': [