Skip to content

Commit acb0fa8

Browse files
committed
Fixed utils.touch which did not work as the 'time' arg was missing, and even if added the method fails if the file does not exist ( at least on linux )
repo.daemon_export: fixed test for it which still used the daemon_serve property that does not exist
1 parent a2ec078 commit acb0fa8

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

TODO

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ General
1313
from a common base. This allows to easily add __eq__, __ne__, __hash__ method
1414
to make their use more comfortable and reduces code duplication.
1515
* References like Tag(Reference), Heads and Remotes should have an own Base class
16-
* Optimize type size by adding __slots__ ( at least )
16+
* Optimize type size by adding __slots__ ( at least ), which would also make sure
17+
no one accidentally adds attributes to classes.
1718
* Add more performance tests, see branch "performance_testing"
1819

1920
Configuration

lib/git/utils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ def dashify(string):
1010
return string.replace('_', '-')
1111

1212
def touch(filename):
13-
os.utime(filename)
13+
fp = open(filename, 'a')
14+
fp.close()
1415

1516
def is_git_dir(d):
1617
""" This is taken from the git setup.c:is_git_directory

test/git/test_repo.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,12 @@ def test_archive_tar(self):
198198
def test_archive_tar_gz(self):
199199
self.repo.archive_tar_gz()
200200

201-
@patch('git.utils.touch')
202-
def test_enable_daemon_serve(self, touch):
203-
self.repo.daemon_serve = False
204-
assert_false(self.repo.daemon_serve)
205-
206-
def test_disable_daemon_serve(self):
207-
self.repo.daemon_serve = True
208-
assert_true(self.repo.daemon_serve)
201+
def test_disable_daemon_export(self):
202+
prev_value = self.repo.daemon_export
203+
self.repo.daemon_export = not prev_value
204+
assert_equal(self.repo.daemon_export, not prev_value)
205+
self.repo.daemon_export = prev_value
206+
assert_equal(self.repo.daemon_export, prev_value)
209207

210208
def test_alternates(self):
211209
cur_alternates = self.repo.alternates

0 commit comments

Comments
 (0)