Initialise and checkout an svn repo

This commit is contained in:
Daniel Milnes 2023-10-01 16:31:39 +01:00
parent ed09a58709
commit bd999398d1
No known key found for this signature in database
GPG key ID: 1701097BBDD44D1B

View file

@ -1,6 +1,8 @@
import tempfile
import unittest
import shutil
from contextlib import ExitStack
import mock
import sh
import powerline_shell.segments.svn as svn
@ -15,14 +17,20 @@ class SvnTest(unittest.TestCase):
("vcs", "show_symbol"): False,
})
self.dirname = tempfile.mkdtemp()
with sh.pushd(self.dirname):
sh.svn("init", ".")
self.upstream_dir = tempfile.mkdtemp()
self.checkout_dir = tempfile.mkdtemp()
sh.svnadmin("create", self.upstream_dir)
sh.svn("checkout", f"file://{self.upstream_dir}", self.checkout_dir)
self.segment = svn.Segment(self.powerline, {})
with ExitStack() as stack:
self._resource = stack.enter_context(sh.pushd(self.checkout_dir))
self.addCleanup(stack.pop_all().close)
def tearDown(self):
shutil.rmtree(self.dirname)
shutil.rmtree(self.upstream_dir)
shutil.rmtree(self.checkout_dir)
@mock.patch("powerline_shell.utils.get_PATH")
def test_svn_not_installed(self, get_PATH):