# HG changeset patch # User Pierre-Yves David # Date 1631905461 -7200 # Node ID 1941064d37130f4683293dd6746def1f4f15c37f # Parent b84fe613de3316f5806cf20b66f7e2c59690027a tests: make removeemptydirs more portable The behavior of pwd change from one system (i.e. default shell/sh) from one system to another so we use fuzzy matching for the output we do not care and we use narrower command call to highlight what we are trying to test here. Differential Revision: https://phab.mercurial-scm.org/D11449 diff -r b84fe613de33 -r 1941064d3713 tests/test-removeemptydirs.t --- a/tests/test-removeemptydirs.t Fri Sep 17 21:04:17 2021 +0200 +++ b/tests/test-removeemptydirs.t Fri Sep 17 21:04:21 2021 +0200 @@ -1,5 +1,13 @@ Tests for experimental.removeemptydirs + $ cat >> pwd.py << EOF + > import os + > try: + > print(os.getcwd()) + > except OSError: + > print("") + > EOF + $ NO_RM=--config=experimental.removeemptydirs=0 $ DO_RM=--config=experimental.removeemptydirs=1 $ isdir() { if [ -d $1 ]; then echo yes; else echo no; fi } @@ -132,8 +140,15 @@ r1 r2 somedir - $ pwd +#if windows + $ "$PYTHON" "$TESTTMP/pwd.py" $TESTTMP/hghistedit/somedir +#else + $ echo ${PWD} # no-pwd-check + $TESTTMP/hghistedit/somedir + $ "$PYTHON" "$TESTTMP/pwd.py" + +#endif $ ls -1 $TESTTMP/hghistedit/somedir foo $ ls -1 @@ -142,6 +157,7 @@ Get out of the doomed directory $ cd $TESTTMP/hghistedit + chdir: error retrieving current directory: getcwd: cannot access parent directories: $ENOENT$ (?) $ hg files --rev . | grep somedir/ somedir/foo