| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -534,6 +534,9 @@ def execute(self, command, | |||
| 534 | 534 | cmd_not_found_exception = OSError | |
| 535 | 535 | # end handle | |
| 536 | 536 | ||
| 537 | + stdout_sink = (PIPE | ||
| 538 | + if with_stdout | ||
| 539 | + else getattr(subprocess, 'DEVNULL', open(os.devnull, 'wb'))) | ||
| 537 | 540 | log.debug("Popen(%s, cwd=%s, universal_newlines=%s, shell=%s)", | |
| 538 | 541 | command, cwd, universal_newlines, shell) | |
| 539 | 542 | try: | |
@@ -543,9 +546,9 @@ def execute(self, command, | |||
| 543 | 546 | bufsize=-1, | |
| 544 | 547 | stdin=istream, | |
| 545 | 548 | stderr=PIPE, | |
| 546 | - stdout=PIPE if with_stdout else open(os.devnull, 'wb'), | ||
| 549 | + stdout=stdout_sink, | ||
| 547 | 550 | shell=shell is not None and shell or self.USE_SHELL, | |
| 548 | - close_fds=(is_posix), # unsupported on windows | ||
| 551 | + close_fds=is_posix, # unsupported on windows | ||
| 549 | 552 | universal_newlines=universal_newlines, | |
| 550 | 553 | creationflags=PROC_CREATIONFLAGS, | |
| 551 | 554 | **subprocess_kwargs | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,7 +25,6 @@ | |||
| 25 | 25 | from git.objects.util import get_object_type_by_name | |
| 26 | 26 | from gitdb.util import hex_to_bin | |
| 27 | 27 | from git.compat import is_win | |
| 28 | - from git.util import HIDE_WINDOWS_KNOWN_ERRORS | ||
| 29 | 28 | ||
| 30 | 29 | ||
| 31 | 30 | class TestBase(TestBase): | |
@@ -42,7 +41,7 @@ def tearDown(self): | |||
| 42 | 41 | def test_base_object(self): | |
| 43 | 42 | # test interface of base object classes | |
| 44 | 43 | types = (Blob, Tree, Commit, TagObject) | |
| 45 | - assert len(types) == len(self.type_tuples) | ||
| 44 | + self.assertEqual(len(types), len(self.type_tuples)) | ||
| 46 | 45 | ||
| 47 | 46 | s = set() | |
| 48 | 47 | num_objs = 0 | |
@@ -56,12 +55,12 @@ def test_base_object(self): | |||
| 56 | 55 | item = obj_type(self.rorepo, binsha, 0, path) | |
| 57 | 56 | # END handle index objects | |
| 58 | 57 | num_objs += 1 | |
| 59 | - assert item.hexsha == hexsha | ||
| 60 | - assert item.type == typename | ||
| 58 | + self.assertEqual(item.hexsha, hexsha) | ||
| 59 | + self.assertEqual(item.type, typename) | ||
| 61 | 60 | assert item.size | |
| 62 | - assert item == item | ||
| 63 | - assert not item != item | ||
| 64 | - assert str(item) == item.hexsha | ||
| 61 | + self.assertEqual(item, item) | ||
| 62 | + self.assertNotEqual(not item, item) | ||
| 63 | + self.assertEqual(str(item), item.hexsha) | ||
| 65 | 64 | assert repr(item) | |
| 66 | 65 | s.add(item) | |
| 67 | 66 | ||
@@ -79,16 +78,16 @@ def test_base_object(self): | |||
| 79 | 78 | ||
| 80 | 79 | tmpfilename = tempfile.mktemp(suffix='test-stream') | |
| 81 | 80 | with open(tmpfilename, 'wb+') as tmpfile: | |
| 82 | - assert item == item.stream_data(tmpfile) | ||
| 81 | + self.assertEqual(item, item.stream_data(tmpfile)) | ||
| 83 | 82 | tmpfile.seek(0) | |
| 84 | - assert tmpfile.read() == data | ||
| 83 | + self.assertEqual(tmpfile.read(), data) | ||
| 85 | 84 | os.remove(tmpfilename) | |
| 86 | 85 | # END for each object type to create | |
| 87 | 86 | ||
| 88 | 87 | # each has a unique sha | |
| 89 | - assert len(s) == num_objs | ||
| 90 | - assert len(s | s) == num_objs | ||
| 91 | - assert num_index_objs == 2 | ||
| 88 | + self.assertEqual(len(s), num_objs) | ||
| 89 | + self.assertEqual(len(s | s), num_objs) | ||
| 90 | + self.assertEqual(num_index_objs, 2) | ||
| 92 | 91 | ||
| 93 | 92 | def test_get_object_type_by_name(self): | |
| 94 | 93 | for tname in base.Object.TYPES: | |
@@ -99,7 +98,7 @@ def test_get_object_type_by_name(self): | |||
| 99 | 98 | ||
| 100 | 99 | def test_object_resolution(self): | |
| 101 | 100 | # objects must be resolved to shas so they compare equal | |
| 102 | - assert self.rorepo.head.reference.object == self.rorepo.active_branch.object | ||
| 101 | + self.assertEqual(self.rorepo.head.reference.object, self.rorepo.active_branch.object) | ||
| 103 | 102 | ||
| 104 | 103 | @with_rw_repo('HEAD', bare=True) | |
| 105 | 104 | def test_with_bare_rw_repo(self, bare_rw_repo): | |
@@ -111,7 +110,7 @@ def test_with_rw_repo(self, rw_repo): | |||
| 111 | 110 | assert not rw_repo.config_reader("repository").getboolean("core", "bare") | |
| 112 | 111 | assert os.path.isdir(os.path.join(rw_repo.working_tree_dir, 'lib')) | |
| 113 | 112 | ||
| 114 | - @skipIf(HIDE_WINDOWS_KNOWN_ERRORS, "FIXME: Freezes!") | ||
| 113 | + #@skipIf(HIDE_WINDOWS_FREEZE_ERRORS, "FIXME: Freezes! sometimes...") | ||
| 115 | 114 | def test_with_rw_remote_and_rw_repo(self): | |
| 116 | 115 | with rw_and_rw_remote_repos(self.rorepo, '0.1.6') as (rw_repo, rw_remote_repo): | |
| 117 | 116 | assert not rw_repo.config_reader("repository").getboolean("core", "bare") | |
| Back | FazBrowse Home | New Git URL |
0 commit comments