Return-Path: Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: (qmail 3634 invoked from network); 12 Apr 2010 12:14:15 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 12 Apr 2010 12:14:15 -0000 Received: (qmail 37954 invoked by uid 500); 12 Apr 2010 12:14:15 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 37924 invoked by uid 500); 12 Apr 2010 12:14:15 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 37917 invoked by uid 99); 12 Apr 2010 12:14:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Apr 2010 12:14:15 +0000 X-ASF-Spam-Status: No, hits=-1816.6 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Apr 2010 12:14:14 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 255B923888E3; Mon, 12 Apr 2010 12:13:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r933211 - /subversion/trunk/subversion/tests/cmdline/patch_tests.py Date: Mon, 12 Apr 2010 12:13:54 -0000 To: commits@subversion.apache.org From: rhuijben@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100412121354.255B923888E3@eris.apache.org> Author: rhuijben Date: Mon Apr 12 12:13:53 2010 New Revision: 933211 URL: http://svn.apache.org/viewvc?rev=933211&view=rev Log: Add a helper function to create a patch file with a specific name in a per test temporary directory and use that to avoid mkstemp's use of file handles. * subversion/tests/cmdline/patch_tests.py (make_patch_path): New function. (*): Use make_patch_path instead of calling msktemp and then closing the handle. Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=933211&r1=933210&r2=933211&view=diff ============================================================================== --- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original) +++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Mon Apr 12 12:13:53 2010 @@ -46,6 +46,11 @@ SkipUnless = svntest.testcase.SkipUnless Item = svntest.wc.StateItem XFail = svntest.testcase.XFail +def make_patch_path(sbox, name='my.patch'): + dir = sbox.add_wc_path('patches') + os.mkdir(dir) + return os.path.abspath(os.path.join(dir, name)) + ######################################################################## #Tests @@ -55,8 +60,7 @@ def patch(sbox): sbox.build() wc_dir = sbox.wc_dir - (fd, patch_file_path) = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir)) - os.close(fd) + patch_file_path = make_patch_path(sbox) mu_path = os.path.join(wc_dir, 'A', 'mu') mu_contents = [ @@ -226,9 +230,7 @@ def patch_absolute_paths(sbox): sbox.build() wc_dir = sbox.wc_dir - dir = os.path.abspath(svntest.main.temp_dir) - (fd, patch_file_path) = tempfile.mkstemp(dir=dir) - os.close(fd) + patch_file_path = make_patch_path(sbox) os.chdir(wc_dir) @@ -291,8 +293,7 @@ def patch_offset(sbox): sbox.build() wc_dir = sbox.wc_dir - (fd, patch_file_path) = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir)) - os.close(fd) + patch_file_path = make_patch_path(sbox) mu_path = os.path.join(wc_dir, 'A', 'mu') iota_path = os.path.join(wc_dir, 'iota') @@ -505,8 +506,7 @@ def patch_chopped_leading_spaces(sbox): sbox.build() wc_dir = sbox.wc_dir - (fd, patch_file_path) = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir)) - os.close(fd) + patch_file_path = make_patch_path(sbox) mu_path = os.path.join(wc_dir, 'A', 'mu') mu_contents = [ @@ -676,8 +676,7 @@ def patch_strip1(sbox): sbox.build() wc_dir = sbox.wc_dir - (fd, patch_file_path) = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir)) - os.close(fd) + patch_file_path = make_patch_path(sbox) mu_path = os.path.join(wc_dir, 'A', 'mu') mu_contents = [ @@ -847,7 +846,7 @@ def patch_no_index_line(sbox): sbox.build() wc_dir = sbox.wc_dir - patch_file_path = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir))[1] + patch_file_path = make_patch_path(sbox) gamma_path = os.path.join(wc_dir, 'A', 'D', 'gamma') iota_path = os.path.join(wc_dir, 'iota') @@ -933,8 +932,7 @@ def patch_add_new_dir(sbox): sbox.build() wc_dir = sbox.wc_dir - (fd, patch_file_path) = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir)) - os.close(fd) + patch_file_path = make_patch_path(sbox) # The first diff is adding 'new' with two missing dirs. The second is # adding 'new' with one missing dir to a 'A' that is locally deleted @@ -1022,8 +1020,7 @@ def patch_reject(sbox): svntest.actions.run_and_verify_commit(wc_dir, expected_output, expected_status, None, wc_dir) - (fd, patch_file_path) = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir)) - os.close(fd) + patch_file_path = make_patch_path(sbox) # Apply patch @@ -1096,8 +1093,7 @@ def patch_keywords(sbox): svntest.actions.run_and_verify_commit(wc_dir, expected_output, expected_status, None, wc_dir) - (fd, patch_file_path) = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir)) - os.close(fd) + patch_file_path = make_patch_path(sbox) # Apply patch @@ -1142,8 +1138,7 @@ def patch_with_fuzz(sbox): sbox.build() wc_dir = sbox.wc_dir - (fd, patch_file_path) = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir)) - os.close(fd) + patch_file_path = make_patch_path(sbox) mu_path = os.path.join(wc_dir, 'A', 'mu') @@ -1283,8 +1278,7 @@ def patch_reverse(sbox): sbox.build() wc_dir = sbox.wc_dir - (fd, patch_file_path) = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir)) - os.close(fd) + patch_file_path = make_patch_path(sbox) mu_path = os.path.join(wc_dir, 'A', 'mu') mu_contents = [ @@ -1454,8 +1448,7 @@ def patch_no_svn_eol_style(sbox): sbox.build() wc_dir = sbox.wc_dir - (fd, patch_file_path) = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir)) - os.close(fd) + patch_file_path = make_patch_path(sbox) mu_path = os.path.join(wc_dir, 'A', 'mu') if os.name == 'nt': @@ -1558,8 +1551,7 @@ def patch_with_svn_eol_style(sbox): sbox.build() wc_dir = sbox.wc_dir - (fd, patch_file_path) = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir)) - os.close(fd) + patch_file_path = make_patch_path(sbox) mu_path = os.path.join(wc_dir, 'A', 'mu') @@ -1673,8 +1665,7 @@ def patch_with_svn_eol_style_uncommitted sbox.build() wc_dir = sbox.wc_dir - (fd, patch_file_path) = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir)) - os.close(fd) + patch_file_path = make_patch_path(sbox) mu_path = os.path.join(wc_dir, 'A', 'mu') @@ -1782,8 +1773,7 @@ def patch_with_include_patterns(sbox): sbox.build() wc_dir = sbox.wc_dir - (fd, patch_file_path) = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir)) - os.close(fd) + patch_file_path = make_patch_path(sbox) mu_path = os.path.join(wc_dir, 'A', 'mu') mu_contents = [ @@ -1941,8 +1931,7 @@ def patch_with_exclude_patterns(sbox): sbox.build() wc_dir = sbox.wc_dir - (fd, patch_file_path) = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir)) - os.close(fd) + patch_file_path = make_patch_path(sbox) mu_path = os.path.join(wc_dir, 'A', 'mu') mu_contents = [ @@ -2102,8 +2091,7 @@ def patch_with_include_exclude_patterns( sbox.build() wc_dir = sbox.wc_dir - (fd, patch_file_path) = tempfile.mkstemp(dir=os.path.abspath(svntest.main.temp_dir)) - os.close(fd) + patch_file_path = make_patch_path(sbox) mu_path = os.path.join(wc_dir, 'A', 'mu') mu_contents = [