diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2009-11-06 10:34:32 +0100 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2009-11-06 10:34:32 +0100 |
commit | d2ff5822dbefa1c9c8177cbf9f0879c5cf4efc5c (patch) | |
tree | 5e1c559f6fb090a6e8affe43bc3aca8b0aef1e4a | |
parent | e0f2bb42b56f770c50a6ef087e9049fa6ac11fb5 (diff) | |
download | gitpython-d2ff5822dbefa1c9c8177cbf9f0879c5cf4efc5c.tar.gz |
Index tests adopted to windows - especially the symlink test needed adjustment, but it works as expected even on systems that do not support symlinks
-rw-r--r-- | test/git/test_index.py | 12 | ||||
-rw-r--r-- | test/testlib/helper.py | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/test/git/test_index.py b/test/git/test_index.py index 6f57538f..1a543f82 100644 --- a/test/git/test_index.py +++ b/test/git/test_index.py @@ -332,7 +332,8 @@ class TestTree(TestBase): # add fake symlink and assure it checks-our as symlink fake_symlink_relapath = "my_fake_symlink" - fake_symlink_path = self._make_file(fake_symlink_relapath, "/etc/that", rw_repo) + link_target = "/etc/that" + fake_symlink_path = self._make_file(fake_symlink_relapath, link_target, rw_repo) fake_entry = BaseIndexEntry((0120000, null_sha, 0, fake_symlink_relapath)) entries = index.reset(new_commit).add([fake_entry]) assert len(entries) == 1 and S_ISLNK(entries[0].mode) @@ -341,5 +342,12 @@ class TestTree(TestBase): assert not S_ISLNK(os.stat(fake_symlink_path)[ST_MODE]) os.remove(fake_symlink_path) index.checkout(fake_symlink_path) - assert S_ISLNK(os.lstat(fake_symlink_path)[ST_MODE]) + + # on windows we will never get symlinks + if os.name == 'nt': + # simlinks should contain the link as text ( which is what a + # symlink actually is ) + open(fake_symlink_path,'rb').read() == link_target + else: + assert S_ISLNK(os.lstat(fake_symlink_path)[ST_MODE]) diff --git a/test/testlib/helper.py b/test/testlib/helper.py index 25b183a3..e33961a7 100644 --- a/test/testlib/helper.py +++ b/test/testlib/helper.py @@ -17,7 +17,7 @@ def fixture_path(name): return os.path.join(test_dir, "fixtures", name) def fixture(name): - return open(fixture_path(name)).read() + return open(fixture_path(name), 'rb').read() def absolute_project_path(): return os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")) |