|
4 | 4 | # |
5 | 5 | # This module is part of GitPython and is released under |
6 | 6 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php |
7 | | - |
8 | | -importgit.objects.baseasbase |
9 | 7 | importos |
| 8 | +importtempfile |
10 | 9 |
|
| 10 | +importgit.objects.baseasbase |
11 | 11 | fromgit.test.libimport ( |
12 | 12 | TestBase, |
13 | 13 | assert_raises, |
@@ -69,10 +69,13 @@ def test_base_object(self): |
69 | 69 | data=data_stream.read() |
70 | 70 | assertdata |
71 | 71 |
|
72 | | -tmpfile=os.tmpfile() |
| 72 | +tmpfilename=tempfile.mktemp(suffix='test-stream') |
| 73 | +tmpfile=open(tmpfilename,'wb+') |
73 | 74 | assertitem==item.stream_data(tmpfile) |
74 | 75 | tmpfile.seek(0) |
75 | 76 | asserttmpfile.read()==data |
| 77 | +tmpfile.close() |
| 78 | +os.remove(tmpfilename) |
76 | 79 | # END stream to file directly |
77 | 80 | # END for each object type to create |
78 | 81 |
|
@@ -113,7 +116,7 @@ def test_add_unicode(self, rw_repo): |
113 | 116 | filename=u"שלום.txt" |
114 | 117 |
|
115 | 118 | file_path=os.path.join(rw_repo.working_dir,filename) |
116 | | -open(file_path,"wb").write('something') |
| 119 | +open(file_path,"wb").write(b'something') |
117 | 120 |
|
118 | 121 | rw_repo.git.add(rw_repo.working_dir) |
119 | 122 | rw_repo.index.commit('message') |