Merge "Add proper __repr__ to merger repo"

This commit is contained in:
Zuul 2019-05-17 08:46:44 +00:00 committed by Gerrit Code Review
commit ddf3afce0a
2 changed files with 9 additions and 0 deletions

View File

@ -296,6 +296,12 @@ class TestMergerRepo(ZuulTestCase):
self.assertEqual(sorted(['messy1.txt', 'messy2.txt']),
sorted(changed_files))
def test_repo_repr(self):
local_path = "/dev/null"
repo = Repo("remote", local_path,
"none@example.org", "User Name", "0", "0")
self.assertIn(local_path, repr(repo))
class TestMergerWithAuthUrl(ZuulTestCase):
config_file = 'zuul-github-driver.conf'

View File

@ -112,6 +112,9 @@ class Repo(object):
except Exception:
self.log.exception("Unable to initialize repo for %s" % remote)
def __repr__(self):
return "<Repo {} {}>".format(hex(id(self)), self.local_path)
def _setup_known_hosts(self):
url = urlparse(self.remote_url)
if 'ssh' not in url.scheme: