Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite6853d5

Browse files
committed
test,#525: allow disabling freeze errors separately
+ cmd: use DEVNULL for non PIPEs; no open-file.+ TCs: some unitestize-assertions on base & remote TCs.
1 parentc485e66 commite6853d5

File tree

4 files changed

+77
-69
lines changed

4 files changed

+77
-69
lines changed

‎git/cmd.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,9 @@ def execute(self, command,
534534
cmd_not_found_exception=OSError
535535
# end handle
536536

537+
stdout_sink= (PIPE
538+
ifwith_stdout
539+
elsegetattr(subprocess,'DEVNULL',open(os.devnull,'wb')))
537540
log.debug("Popen(%s, cwd=%s, universal_newlines=%s, shell=%s)",
538541
command,cwd,universal_newlines,shell)
539542
try:
@@ -543,9 +546,9 @@ def execute(self, command,
543546
bufsize=-1,
544547
stdin=istream,
545548
stderr=PIPE,
546-
stdout=PIPEifwith_stdoutelseopen(os.devnull,'wb'),
549+
stdout=stdout_sink,
547550
shell=shellisnotNoneandshellorself.USE_SHELL,
548-
close_fds=(is_posix),# unsupported on windows
551+
close_fds=is_posix,# unsupported on windows
549552
universal_newlines=universal_newlines,
550553
creationflags=PROC_CREATIONFLAGS,
551554
**subprocess_kwargs

‎git/test/test_base.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
fromgit.objects.utilimportget_object_type_by_name
2626
fromgitdb.utilimporthex_to_bin
2727
fromgit.compatimportis_win
28-
fromgit.utilimportHIDE_WINDOWS_KNOWN_ERRORS
2928

3029

3130
classTestBase(TestBase):
@@ -42,7 +41,7 @@ def tearDown(self):
4241
deftest_base_object(self):
4342
# test interface of base object classes
4443
types= (Blob,Tree,Commit,TagObject)
45-
assertlen(types)==len(self.type_tuples)
44+
self.assertEqual(len(types),len(self.type_tuples))
4645

4746
s=set()
4847
num_objs=0
@@ -56,12 +55,12 @@ def test_base_object(self):
5655
item=obj_type(self.rorepo,binsha,0,path)
5756
# END handle index objects
5857
num_objs+=1
59-
assertitem.hexsha==hexsha
60-
assertitem.type==typename
58+
self.assertEqual(item.hexsha,hexsha)
59+
self.assertEqual(item.type,typename)
6160
assertitem.size
62-
assertitem==item
63-
assertnotitem!=item
64-
assertstr(item)==item.hexsha
61+
self.assertEqual(item,item)
62+
self.assertNotEqual(notitem,item)
63+
self.assertEqual(str(item),item.hexsha)
6564
assertrepr(item)
6665
s.add(item)
6766

@@ -79,16 +78,16 @@ def test_base_object(self):
7978

8079
tmpfilename=tempfile.mktemp(suffix='test-stream')
8180
withopen(tmpfilename,'wb+')astmpfile:
82-
assertitem==item.stream_data(tmpfile)
81+
self.assertEqual(item,item.stream_data(tmpfile))
8382
tmpfile.seek(0)
84-
asserttmpfile.read()==data
83+
self.assertEqual(tmpfile.read(),data)
8584
os.remove(tmpfilename)
8685
# END for each object type to create
8786

8887
# each has a unique sha
89-
assertlen(s)==num_objs
90-
assertlen(s|s)==num_objs
91-
assertnum_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)
9291

9392
deftest_get_object_type_by_name(self):
9493
fortnameinbase.Object.TYPES:
@@ -99,7 +98,7 @@ def test_get_object_type_by_name(self):
9998

10099
deftest_object_resolution(self):
101100
# objects must be resolved to shas so they compare equal
102-
assertself.rorepo.head.reference.object==self.rorepo.active_branch.object
101+
self.assertEqual(self.rorepo.head.reference.object,self.rorepo.active_branch.object)
103102

104103
@with_rw_repo('HEAD',bare=True)
105104
deftest_with_bare_rw_repo(self,bare_rw_repo):
@@ -111,7 +110,7 @@ def test_with_rw_repo(self, rw_repo):
111110
assertnotrw_repo.config_reader("repository").getboolean("core","bare")
112111
assertos.path.isdir(os.path.join(rw_repo.working_tree_dir,'lib'))
113112

114-
@skipIf(HIDE_WINDOWS_KNOWN_ERRORS,"FIXME: Freezes!")
113+
#@skipIf(HIDE_WINDOWS_FREEZE_ERRORS, "FIXME: Freezes! sometimes...")
115114
deftest_with_rw_remote_and_rw_repo(self):
116115
withrw_and_rw_remote_repos(self.rorepo,'0.1.6')as (rw_repo,rw_remote_repo):
117116
assertnotrw_repo.config_reader("repository").getboolean("core","bare")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp