浏览代码

Use platform-specific file path separators to avoid tests

  dulwich.tests.test_web.DumbHandlersTestCase:test_get_idx_file
  dulwich.tests.test_web.DumbHandlersTestCase:test_get_pack_file

failing on Windows with "File not found" error.
Risto Kankkunen 13 年之前
父节点
当前提交
90c0c803f8
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      dulwich/tests/test_web.py

+ 3 - 2
dulwich/tests/test_web.py

@@ -20,6 +20,7 @@
 
 from cStringIO import StringIO
 import re
+import os
 
 from dulwich.object_store import (
     MemoryObjectStore,
@@ -198,7 +199,7 @@ class DumbHandlersTestCase(WebTestCase):
         self.assertEquals(HTTP_ERROR, self._status)
 
     def test_get_pack_file(self):
-        pack_name = 'objects/pack/pack-%s.pack' % ('1' * 40)
+        pack_name = os.path.join('objects', 'pack', 'pack-%s.pack' % ('1' * 40))
         backend = _test_backend([], named_files={pack_name: 'pack contents'})
         mat = re.search('.*', pack_name)
         output = ''.join(get_pack_file(self._req, backend, mat))
@@ -208,7 +209,7 @@ class DumbHandlersTestCase(WebTestCase):
         self.assertTrue(self._req.cached)
 
     def test_get_idx_file(self):
-        idx_name = 'objects/pack/pack-%s.idx' % ('1' * 40)
+        idx_name = os.path.join('objects', 'pack', 'pack-%s.idx' % ('1' * 40))
         backend = _test_backend([], named_files={idx_name: 'idx contents'})
         mat = re.search('.*', idx_name)
         output = ''.join(get_idx_file(self._req, backend, mat))