Skip to content

Commit feb9c85

Browse files
author
Buck Ryan
committed
fix bug in svn segment
1 parent 067202f commit feb9c85

File tree

4 files changed

+42
-5
lines changed

4 files changed

+42
-5
lines changed

Diff for: Dockerfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ RUN apk add --no-cache --update \
99
git \
1010
mercurial \
1111
php5 \
12-
subversion && \
12+
subversion \
13+
&& \
1314
rm -rf /var/cache/apk/*
1415

1516
RUN mkdir /code
@@ -22,7 +23,9 @@ RUN bzr whoami "root <[email protected]>" && \
2223
git config --global user.email "[email protected]" && \
2324
git config --global user.name "root"
2425

25-
COPY . ./
26-
RUN ./setup.py install
26+
# COPY . ./
27+
# RUN ./setup.py install
2728

2829
ENV USER root
30+
31+
CMD ["nosetests"]

Diff for: powerline_shell/segments/svn.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def build_stats():
3939
env=get_subprocess_env())
4040
except OSError:
4141
# Popen will throw an OSError if svn is not found
42-
return None
42+
return None, None
4343
pdata = p.communicate()
4444
if p.returncode != 0 or pdata[1][:22] == b'svn: warning: W155007:':
4545
return None, None

Diff for: test.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/sh
22
set -eu
33
docker build -t powerline-shell .
4-
docker run --rm -it powerline-shell nosetests "$@"
4+
docker run --rm --interactive --tty \
5+
--volume $PWD:/code \
6+
powerline-shell "$@"

Diff for: test/segments_test/svn_test.py

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import tempfile
2+
import unittest
3+
import shutil
4+
import mock
5+
import sh
6+
import powerline_shell.segments.svn as svn
7+
from ..testing_utils import dict_side_effect_fn
8+
9+
10+
class SvnTest(unittest.TestCase):
11+
12+
def setUp(self):
13+
self.powerline = mock.MagicMock()
14+
self.powerline.segment_conf.side_effect = dict_side_effect_fn({
15+
("vcs", "show_symbol"): False,
16+
})
17+
18+
self.dirname = tempfile.mkdtemp()
19+
sh.cd(self.dirname)
20+
# sh.svn("init", ".")
21+
22+
self.segment = svn.Segment(self.powerline, {})
23+
24+
def tearDown(self):
25+
shutil.rmtree(self.dirname)
26+
27+
@mock.patch("powerline_shell.utils.get_PATH")
28+
def test_svn_not_installed(self, get_PATH):
29+
get_PATH.return_value = "" # so svn can't be found
30+
self.segment.start()
31+
self.segment.add_to_powerline()
32+
self.assertEqual(self.powerline.append.call_count, 0)

0 commit comments

Comments
 (0)