mirror of
https://github.com/b-ryan/powerline-shell.git
synced 2026-09-09 23:16:23 -04:00
fix bug in svn segment
This commit is contained in:
parent
067202f71a
commit
feb9c8550e
|
|
@ -9,7 +9,8 @@ RUN apk add --no-cache --update \
|
|||
git \
|
||||
mercurial \
|
||||
php5 \
|
||||
subversion && \
|
||||
subversion \
|
||||
&& \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
RUN mkdir /code
|
||||
|
|
@ -22,7 +23,9 @@ RUN bzr whoami "root <root@example.com>" && \
|
|||
git config --global user.email "root@example.com" && \
|
||||
git config --global user.name "root"
|
||||
|
||||
COPY . ./
|
||||
RUN ./setup.py install
|
||||
# COPY . ./
|
||||
# RUN ./setup.py install
|
||||
|
||||
ENV USER root
|
||||
|
||||
CMD ["nosetests"]
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ def build_stats():
|
|||
env=get_subprocess_env())
|
||||
except OSError:
|
||||
# Popen will throw an OSError if svn is not found
|
||||
return None
|
||||
return None, None
|
||||
pdata = p.communicate()
|
||||
if p.returncode != 0 or pdata[1][:22] == b'svn: warning: W155007:':
|
||||
return None, None
|
||||
|
|
|
|||
4
test.sh
4
test.sh
|
|
@ -1,4 +1,6 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
docker build -t powerline-shell .
|
||||
docker run --rm -it powerline-shell nosetests "$@"
|
||||
docker run --rm --interactive --tty \
|
||||
--volume $PWD:/code \
|
||||
powerline-shell "$@"
|
||||
|
|
|
|||
32
test/segments_test/svn_test.py
Normal file
32
test/segments_test/svn_test.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import tempfile
|
||||
import unittest
|
||||
import shutil
|
||||
import mock
|
||||
import sh
|
||||
import powerline_shell.segments.svn as svn
|
||||
from ..testing_utils import dict_side_effect_fn
|
||||
|
||||
|
||||
class SvnTest(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.powerline = mock.MagicMock()
|
||||
self.powerline.segment_conf.side_effect = dict_side_effect_fn({
|
||||
("vcs", "show_symbol"): False,
|
||||
})
|
||||
|
||||
self.dirname = tempfile.mkdtemp()
|
||||
sh.cd(self.dirname)
|
||||
# sh.svn("init", ".")
|
||||
|
||||
self.segment = svn.Segment(self.powerline, {})
|
||||
|
||||
def tearDown(self):
|
||||
shutil.rmtree(self.dirname)
|
||||
|
||||
@mock.patch("powerline_shell.utils.get_PATH")
|
||||
def test_svn_not_installed(self, get_PATH):
|
||||
get_PATH.return_value = "" # so svn can't be found
|
||||
self.segment.start()
|
||||
self.segment.add_to_powerline()
|
||||
self.assertEqual(self.powerline.append.call_count, 0)
|
||||
Loading…
Reference in a new issue