view tests/test-init.py @ 200:7da1dad166b5

client: ignore close() on non-open clients (issue5751) Closing a client twice currently triggers a rather confusing exception. Instead, follow the convention set by Python's file objects, and ignore close() commands on non-open clients.
author Gábor Stefanik <gabor.stefanik@nng.com>
date Mon, 12 Feb 2018 14:54:09 +0100
parents c1b966866ed7
children
line wrap: on
line source

from tests import common
import hglib, shutil
from hglib.util import b

class test_init(common.basetest):
    def test_exists(self):
        self.assertRaises(hglib.error.CommandError, hglib.init)

    def test_basic(self):
        self.client.close()
        self.client = None
        shutil.rmtree('.hg')

        self.client = hglib.init().open()
        self.assertTrue(self.client.root().endswith(b('test_init')))