diff options
Diffstat (limited to 'git/test/test_docs.py')
-rw-r--r-- | git/test/test_docs.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/git/test/test_docs.py b/git/test/test_docs.py index 8a2dff0f..e2bfcb21 100644 --- a/git/test/test_docs.py +++ b/git/test/test_docs.py @@ -16,6 +16,9 @@ class Tutorials(TestBase): import gc gc.collect() + # @skipIf(HIDE_WINDOWS_KNOWN_ERRORS, + # "FIXME: helper.wrapper fails with: PermissionError: [WinError 5] Access is denied: " + # "'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\test_work_tree_unsupportedryfa60di\\master_repo\\.git\\objects\\pack\\pack-bc9e0787aef9f69e1591ef38ea0a6f566ec66fe3.idx") # noqa E501 @with_rw_directory def test_init_repo_object(self, rw_dir): # [1-test_init_repo_object] @@ -36,8 +39,8 @@ class Tutorials(TestBase): # [3-test_init_repo_object] repo.config_reader() # get a config reader for read-only access - cw = repo.config_writer() # get a config writer to change configuration - cw.release() # call release() to be sure changes are written and locks are released + with repo.config_writer(): # get a config writer to change configuration + pass # call release() to be sure changes are written and locks are released # ![3-test_init_repo_object] # [4-test_init_repo_object] @@ -67,7 +70,8 @@ class Tutorials(TestBase): # heads, tags and references # heads are branches in git-speak # [8-test_init_repo_object] - self.assertEqual(repo.head.ref, repo.heads.master) # head is a sym-ref pointing to master + self.assertEqual(repo.head.ref, repo.heads.master, # head is a sym-ref pointing to master + "It's ok if TC not running from `master`.") self.assertEqual(repo.tags['0.3.5'], repo.tag('refs/tags/0.3.5')) # you can access tags in various ways too self.assertEqual(repo.refs.master, repo.heads['master']) # .refs provides all refs, ie heads ... @@ -239,9 +243,9 @@ class Tutorials(TestBase): # [8-test_references_and_objects] hc = repo.head.commit hct = hc.tree - hc != hct - hc != repo.tags[0] - hc == repo.head.reference.commit + hc != hct # @NoEffect + hc != repo.tags[0] # @NoEffect + hc == repo.head.reference.commit # @NoEffect # ![8-test_references_and_objects] # [9-test_references_and_objects] @@ -344,7 +348,7 @@ class Tutorials(TestBase): # The index contains all blobs in a flat list assert len(list(index.iter_blobs())) == len([o for o in repo.head.commit.tree.traverse() if o.type == 'blob']) # Access blob objects - for (path, stage), entry in index.entries.items(): + for (path, stage), entry in index.entries.items(): # @UnusedVariable pass new_file_path = os.path.join(repo.working_tree_dir, 'new-file-name') open(new_file_path, 'w').close() @@ -394,9 +398,8 @@ class Tutorials(TestBase): # [26-test_references_and_objects] assert origin.url == repo.remotes.origin.url - cw = origin.config_writer - cw.set("pushurl", "other_url") - cw.release() + with origin.config_writer as cw: + cw.set("pushurl", "other_url") # Please note that in python 2, writing origin.config_writer.set(...) is totally safe. # In py3 __del__ calls can be delayed, thus not writing changes in time. |