SETUP = $(PYTHON) setup.py
PYDOCTOR ?= pydoctor
TESTRUNNER ?= unittest
-RUNTEST = PYTHONHASHSEED=random PYTHONPATH=.:$(PYTHONPATH) $(PYTHON) -m $(TESTRUNNER) $(TEST_OPTIONS)
+RUNTEST = PYTHONHASHSEED=random PYTHONPATH=$(shell pwd):$(PYTHONPATH) $(PYTHON) -m $(TESTRUNNER) $(TEST_OPTIONS)
COVERAGE = python3-coverage
DESTDIR=/
* Fix handling of encoding for tags. (Jelmer Vernooij, #608)
+ * Fix tutorial tests on Python 3. (Jelmer Vernooij, #573)
+
0.19.2 2018-04-07
BUG FIXES
write_tree_diff::
>>> from dulwich.patch import write_tree_diff
- >>> import sys
- >>> write_tree_diff(sys.stdout, repo.object_store, commit.tree, tree.id)
+ >>> from io import BytesIO
+ >>> out = BytesIO()
+ >>> write_tree_diff(out, repo.object_store, commit.tree, tree.id)
+ >>> import sys; _ = sys.stdout.write(out.getvalue().decode('ascii'))
diff --git a/spam b/spam
index c55063a..16ee268 100644
--- a/spam
>>> from dulwich.repo import Repo
>>> from dulwich.server import DictBackend, TCPGitServer
>>> import threading
- >>> repo = Repo.init(b"remote", mkdir=True)
+ >>> repo = Repo.init("remote", mkdir=True)
>>> cid = repo.do_commit(b"message", committer=b"Jelmer <jelmer@samba.org>")
>>> backend = DictBackend({b'/': repo})
>>> dul_server = TCPGitServer(backend, b'localhost', 0)
one manually::
>>> from dulwich.client import TCPGitClient
- >>> client = TCPGitClient(server_address.encode('ascii'), server_port)
+ >>> client = TCPGitClient(server_address, server_port)
Retrieving raw pack files
-------------------------
importing the received pack file into the local repository::
>>> from dulwich.repo import Repo
- >>> local = Repo.init(b"local", mkdir=True)
+ >>> local = Repo.init("local", mkdir=True)
>>> remote_refs = client.fetch(b"/", local)
Let's shut down the server now that all tests have been run::
call::
>>> index = repo.open_index()
- >>> print(index.path.decode(sys.getfilesystemencoding()))
+ >>> print(index.path)
myrepo/.git/index
Since the repository was just created, the index will be empty::
def nocompat_test_suite():
result = unittest.TestSuite()
result.addTests(self_test_suite())
+ result.addTests(tutorial_test_suite())
from dulwich.contrib import test_suite as contrib_test_suite
- if sys.version_info[0] == 2:
- result.addTests(tutorial_test_suite())
result.addTests(contrib_test_suite())
return result
def test_suite():
result = unittest.TestSuite()
result.addTests(self_test_suite())
- if sys.version_info[0] == 2 and sys.platform != 'win32':
+ if sys.platform != 'win32':
result.addTests(tutorial_test_suite())
from dulwich.tests.compat import test_suite as compat_test_suite
result.addTests(compat_test_suite())