dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00847
Re: Python 3 compatibility
Jelmer Vernooij <jelmer@xxxxxxxxx> writes:
> On Thu, Dec 03, 2015 at 06:37:48PM +0100, Lele Gaifax wrote:
>> And what about URLs? I'm looking around the code base, starting from the
>> "skipIfPy3" marked tests, and many of them are in client/server area where
>> URLs are passed around (where an URL may be a local filesystem path).
>
> The only skipIfPy3 tests should be the C git compatibility tests
> against the Dulwich HTTP server.
Ok.
To get an idea of what is missing, the "broke" the skipIfPY3 marker so
that all those tests are executed also under Py3. What I was actually asking
is what should happen to tests like
class TestGetTransportAndPath(TestCase):
def test_tcp(self):
c, path = get_transport_and_path('git://foo.com/bar/baz')
self.assertTrue(isinstance(c, TCPGitClient))
self.assertEqual('foo.com', c._host)
self.assertEqual(TCP_GIT_PORT, c._port)
self.assertEqual('/bar/baz', path)
Should that become
class TestGetTransportAndPath(TestCase):
def test_tcp(self):
c, path = get_transport_and_path(b'git://foo.com/bar/baz')
self.assertTrue(isinstance(c, TCPGitClient))
self.assertEqual(b'foo.com', c._host)
self.assertEqual(TCP_GIT_PORT, c._port)
self.assertEqual(b'/bar/baz', path)
or rather a "primitive" function like `get_transport_and_path` should accept
either a (unicode) string or a (bytes) string?
As another case, should the following
class PorcelainTestCase(TestCase):
def setUp(self):
super(PorcelainTestCase, self).setUp()
repo_dir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, repo_dir)
self.repo = Repo.init(repo_dir)
remain valid code (and thus `Repo.init()` able to deal with either kind of
"strings", and then the responsibility of "switching" to bytes paths be
shifted to more internal objects, possibly thru `_fs_to_tree_path`)?
Thanks for your patience,
ciao, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@xxxxxxxxxxxxxxx | -- Fortunato Depero, 1929.
References