Patchwork D1636: tests: use Python to write binary data in lfs test instead of shell

login
register
mail settings
Submitter phabricator
Date Dec. 10, 2017, 1:50 a.m.
Message ID <differential-rev-PHID-DREV-yjbzekg7ravhr3bq3d2q-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26154/
State Superseded
Headers show

Comments

phabricator - Dec. 10, 2017, 1:50 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The shell construct here appears to be unevenly supported: it works in /bin/sh
  on FreeBSD, but it doesn't seem to work when /bin/sh is dash. Using a Python
  inline directive works fine, so let's just do that instead.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1636

AFFECTED FILES
  tests/test-lfs.t

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-lfs.t b/tests/test-lfs.t
--- a/tests/test-lfs.t
+++ b/tests/test-lfs.t
@@ -232,9 +232,10 @@ 
   $ hg mv b1 a2
   $ hg commit -m b
   $ hg status
-  $ HEADER=$'\1\n'
-  $ printf '%sSTART-WITH-HG-FILELOG-METADATA' "$HEADER" > a2
-  $ printf '%sMETA\n' "$HEADER" > a1
+  >>> with open('a2', 'wb') as f:
+  ...     f.write('\1\nSTART-WITH-HG-FILELOG-METADATA')
+  >>> with open('a1', 'wb') as f:
+  ...     f.write('\1\nMETA\n')
   $ hg commit -m meta
   $ hg status
   $ hg log -T '{rev}: {file_copies} | {file_dels} | {file_adds}\n'