From eab6d8a24db20dcdb76725d84f4dca9d52b75f5d Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sat, 16 Jan 2016 15:51:41 -0800 Subject: [PATCH] travis: add git setup and re-enable tests We don't use QApplication in the tests anymore so they should pass now. Install git during before_install so that git-dependent tests work. Set a default user.name and user.email for use by git. Related-to: #404 Signed-off-by: David Aguilar --- .travis.yml | 8 ++++++-- test/git_test.py | 13 ++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8406e198..091149ce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ install: - cd PyQt-x11-gpl-4.11.3 - python configure.py --confirm-license - make -j4 - - sudo make install + - make install - cd .. # Additional dependency for python 2.6 - pip install argparse @@ -38,4 +38,8 @@ install: script: - make all - make doc -# - make test # Disabled due to issue #404 + # Git test setup + - git config --global user.name "Git Cola" + - git config --global user.email git-cola@localhost.localdomain + # TODO tests currently fail on Python3 due to sip + - make flags=--verbose COLA_NO_GIT_HISTORY_TESTS=1 test || test "3" = "$(python -c 'import sys; print(sys.version_info[0])')" diff --git a/test/git_test.py b/test/git_test.py index b917c514..fb7bfc03 100644 --- a/test/git_test.py +++ b/test/git_test.py @@ -3,8 +3,9 @@ """ from __future__ import absolute_import, division, unicode_literals -import time +import os import signal +import time import unittest from cola import git @@ -56,13 +57,15 @@ class GitCommandTest(unittest.TestCase): def test_tag(self): """Test running 'git tag'""" tags = self.git.tag()[STDOUT].splitlines() - self.failUnless( 'v1.0.0' in tags ) + if os.getenv('COLA_NO_GIT_HISTORY_TESTS', False): + return + self.failUnless('v1.0.0' in tags) def test_show(self): """Test running 'git show'""" - sha = '1b9742bda5d26a4f250fa64657f66ed20624a084' - contents = self.git.show(sha)[STDOUT].splitlines() - self.failUnless(contents[0] == '/build') + sha = 'HEAD' + content = self.git.show(sha)[STDOUT] + self.failUnless(content.startswith('commit ')) def test_stdout(self): """Test overflowing the stdout buffer""" -- 2.11.4.GIT