D4546: tests: handle Python 3 not quoting non-empty-directory error

2018-09-12 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.


  This motivated me to install py3, and give it a try.  But the test runner 
keeps crashing on str/bytes issues.  I fixed a couple, but it looks like 
treating everything as bytes can be a problem, since environment stuff 
internally wants to uppercase, which wants a str (apparently).
  
$ /c/Program\ Files/Python37/python run-tests.py --local test-update-names.t
Traceback (most recent call last):
  File "run-tests.py", line 3194, in 
sys.exit(runner.run(sys.argv[1:]))
  File "run-tests.py", line 2475, in run
self._checktools()
  File "run-tests.py", line 3123, in _checktools
found = self._findprogram(p)
  File "run-tests.py", line 3112, in _findprogram
for p in osenvironb.get(b'PATH', dpb).split(sepb):
  File "c:\Program Files\Python37\lib\_collections_abc.py", line 660, in get
return self[key]
  File "c:\Program Files\Python37\lib\os.py", line 675, in __getitem__
value = self._data[self.encodekey(key)]
  File "c:\Program Files\Python37\lib\os.py", line 744, in encodekey
return encode(key).upper()
  File "c:\Program Files\Python37\lib\os.py", line 739, in check_str
raise TypeError("str expected, not %s" % type(value).__name__)
TypeError: str expected, not bytes
  
  I "fixed" that with the following...
  
@@ -3107,10 +3107,12 @@ class TestRunner(object):
 
 def _findprogram(self, program):
 """Search PATH for a executable program"""
-dpb = _bytespath(os.defpath)
-sepb = _bytespath(os.pathsep)
-for p in osenvironb.get(b'PATH', dpb).split(sepb):
-name = os.path.join(p, program)
+#dpb = _bytespath(os.defpath)
+#sepb = _bytespath(os.pathsep)
+dpb = os.defpath
+sepb = os.pathsep
+for p in osenvironb.get('PATH', dpb).split(sepb):
+name = os.path.join(_bytespath(p), program)
 if os.name == 'nt' or os.access(name, os.X_OK):
 return name
 return None
  
  ... and then got a crash with a warning that the Windows bytes API is 
deprecated.
  
$ /c/Program\ Files/Python37/python run-tests.py --local test-update-names.t
run-tests.py:2491: DeprecationWarning: The Windows bytes API has been 
deprecated, use Unicode filenames instead
  os, 'getcwdb', os.getcwd)()
Traceback (most recent call last):
  File "run-tests.py", line 3196, in 
sys.exit(runner.run(sys.argv[1:]))
  File "run-tests.py", line 2480, in run
result = self._run(testdescs)
  File "run-tests.py", line 2491, in _run
os, 'getcwdb', os.getcwd)()
  File "c:\Program Files\Python37\lib\os.py", line 682, in __setitem__
key = self.encodekey(key)
  File "c:\Program Files\Python37\lib\os.py", line 744, in encodekey
return encode(key).upper()
  File "c:\Program Files\Python37\lib\os.py", line 739, in check_str
raise TypeError("str expected, not %s" % type(value).__name__)
TypeError: str expected, not bytes

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, pulkit
Cc: mharbison72, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4546: tests: handle Python 3 not quoting non-empty-directory error

2018-09-12 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGcb1329738d64: tests: handle Python 3 not quoting 
non-empty-directory error (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4546?vs=10954=10956

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

AFFECTED FILES
  tests/test-merge1.t
  tests/test-update-names.t

CHANGE DETAILS

diff --git a/tests/test-update-names.t b/tests/test-update-names.t
--- a/tests/test-update-names.t
+++ b/tests/test-update-names.t
@@ -50,8 +50,8 @@
   $ hg st
   ? name/file
   $ hg up 1
-  abort: Unlinking directory not permitted: '$TESTTMP/r1/r2/name' (windows !)
-  abort: Directory not empty: '$TESTTMP/r1/r2/name' (no-windows !)
+  abort: Unlinking directory not permitted: '?$TESTTMP/r1/r2/name'? (re) 
(windows !)
+  abort: Directory not empty: '?\$TESTTMP/r1/r2/name'? (re) (no-windows !)
   [255]
   $ cat name/file
   text
diff --git a/tests/test-merge1.t b/tests/test-merge1.t
--- a/tests/test-merge1.t
+++ b/tests/test-merge1.t
@@ -30,8 +30,8 @@
 
   $ mkdir b && touch b/nonempty
   $ hg up
-  abort: Unlinking directory not permitted: '$TESTTMP/t/b' (windows !)
-  abort: Directory not empty: '$TESTTMP/t/b' (no-windows !)
+  abort: Unlinking directory not permitted: '?\$TESTTMP/t/b'? (re) (windows !)
+  abort: Directory not empty: '?\$TESTTMP/t/b'? (re) (no-windows !)
   [255]
   $ hg ci
   abort: last update was interrupted



To: durin42, #hg-reviewers, pulkit
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D4546: tests: handle Python 3 not quoting non-empty-directory error

2018-09-12 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I assume this happens on Windows too, so I did the same regex on both
  versions of the output. The whole message printed by these aborts
  comes from Python, so if we want to exert control over the quoting
  here it'll be a bit of a pain.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-merge1.t
  tests/test-update-names.t

CHANGE DETAILS

diff --git a/tests/test-update-names.t b/tests/test-update-names.t
--- a/tests/test-update-names.t
+++ b/tests/test-update-names.t
@@ -50,8 +50,8 @@
   $ hg st
   ? name/file
   $ hg up 1
-  abort: Unlinking directory not permitted: '$TESTTMP/r1/r2/name' (windows !)
-  abort: Directory not empty: '$TESTTMP/r1/r2/name' (no-windows !)
+  abort: Unlinking directory not permitted: '?$TESTTMP/r1/r2/name'? (re) 
(windows !)
+  abort: Directory not empty: '?\$TESTTMP/r1/r2/name'? (re) (no-windows !)
   [255]
   $ cat name/file
   text
diff --git a/tests/test-merge1.t b/tests/test-merge1.t
--- a/tests/test-merge1.t
+++ b/tests/test-merge1.t
@@ -30,8 +30,8 @@
 
   $ mkdir b && touch b/nonempty
   $ hg up
-  abort: Unlinking directory not permitted: '$TESTTMP/t/b' (windows !)
-  abort: Directory not empty: '$TESTTMP/t/b' (no-windows !)
+  abort: Unlinking directory not permitted: '?\$TESTTMP/t/b'? (re) (windows !)
+  abort: Directory not empty: '?\$TESTTMP/t/b'? (re) (no-windows !)
   [255]
   $ hg ci
   abort: last update was interrupted



To: durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel