Mercurial > hg-stable
changeset 41160:a9905045b992
tests: get access to thirdparty.cbor without requiring it to be installed
This makes the test a noop when run from a tarball, but in return we can stop
shipping a library we don't use.
Differential Revision: https://phab.mercurial-scm.org/D5523
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 07 Jan 2019 18:41:53 -0500 |
parents | 23d5e03dad70 |
children | 98ce494e104d |
files | tests/test-cbor.py |
diffstat | 1 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-cbor.py Mon Jan 07 17:19:19 2019 -0500 +++ b/tests/test-cbor.py Mon Jan 07 18:41:53 2019 -0500 @@ -1,10 +1,19 @@ from __future__ import absolute_import +import os +import sys import unittest -from mercurial.thirdparty import ( - cbor, -) +# TODO migrate to canned cbor test strings and stop using thirdparty.cbor +tpp = os.path.normpath(os.path.join(os.path.dirname(__file__), + '..', 'mercurial', 'thirdparty')) +if not os.path.exists(tpp): + # skip, not in a repo + sys.exit(80) +sys.path[0:0] = [tpp] +import cbor +del sys.path[0] + from mercurial.utils import ( cborutil, )