tests/test-extension.t
branchstable
changeset 33622 b4793cc8e1c0
parent 33621 23f999211940
child 33762 86aca74a063b
equal deleted inserted replaced
33621:23f999211940 33622:b4793cc8e1c0
   243   (extroot) import extroot.bar in func(): this is extroot.bar
   243   (extroot) import extroot.bar in func(): this is extroot.bar
   244   $TESTTMP/a (glob)
   244   $TESTTMP/a (glob)
   245 
   245 
   246 #if no-py3k
   246 #if no-py3k
   247   $ rm "$TESTTMP"/extroot/foo.*
   247   $ rm "$TESTTMP"/extroot/foo.*
       
   248   $ rm -Rf "$TESTTMP/extroot/__pycache__"
   248   $ cat > $TESTTMP/extroot/foo.py <<EOF
   249   $ cat > $TESTTMP/extroot/foo.py <<EOF
   249   > # test relative import
   250   > # test relative import
   250   > buf = []
   251   > buf = []
   251   > def func():
   252   > def func():
   252   >     # "not locals" case
   253   >     # "not locals" case
  1236   ** Extensions loaded: throw
  1237   ** Extensions loaded: throw
  1237 
  1238 
  1238 If the extension specifies a buglink, show that:
  1239 If the extension specifies a buglink, show that:
  1239   $ echo 'buglink = "http://example.com/bts"' >> throw.py
  1240   $ echo 'buglink = "http://example.com/bts"' >> throw.py
  1240   $ rm -f throw.pyc throw.pyo
  1241   $ rm -f throw.pyc throw.pyo
       
  1242   $ rm -Rf __pycache__
  1241   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
  1243   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
  1242   ** Unknown exception encountered with possibly-broken third-party extension throw
  1244   ** Unknown exception encountered with possibly-broken third-party extension throw
  1243   ** which supports versions unknown of Mercurial.
  1245   ** which supports versions unknown of Mercurial.
  1244   ** Please disable throw and try your action again.
  1246   ** Please disable throw and try your action again.
  1245   ** If that fixes the bug please report it to http://example.com/bts
  1247   ** If that fixes the bug please report it to http://example.com/bts
  1251   $ echo "from mercurial import util" >> older.py
  1253   $ echo "from mercurial import util" >> older.py
  1252   $ echo "util.version = lambda:'2.2'" >> older.py
  1254   $ echo "util.version = lambda:'2.2'" >> older.py
  1253   $ echo "testedwith = '1.9.3'" >> older.py
  1255   $ echo "testedwith = '1.9.3'" >> older.py
  1254   $ echo "testedwith = '2.1.1'" >> throw.py
  1256   $ echo "testedwith = '2.1.1'" >> throw.py
  1255   $ rm -f throw.pyc throw.pyo
  1257   $ rm -f throw.pyc throw.pyo
       
  1258   $ rm -Rf __pycache__
  1256   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
  1259   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
  1257   >   throw 2>&1 | egrep '^\*\*'
  1260   >   throw 2>&1 | egrep '^\*\*'
  1258   ** Unknown exception encountered with possibly-broken third-party extension older
  1261   ** Unknown exception encountered with possibly-broken third-party extension older
  1259   ** which supports versions 1.9 of Mercurial.
  1262   ** which supports versions 1.9 of Mercurial.
  1260   ** Please disable older and try your action again.
  1263   ** Please disable older and try your action again.
  1264   ** Extensions loaded: throw, older
  1267   ** Extensions loaded: throw, older
  1265 
  1268 
  1266 One extension only tested with older, one only with newer versions:
  1269 One extension only tested with older, one only with newer versions:
  1267   $ echo "util.version = lambda:'2.1'" >> older.py
  1270   $ echo "util.version = lambda:'2.1'" >> older.py
  1268   $ rm -f older.pyc older.pyo
  1271   $ rm -f older.pyc older.pyo
       
  1272   $ rm -Rf __pycache__
  1269   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
  1273   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
  1270   >   throw 2>&1 | egrep '^\*\*'
  1274   >   throw 2>&1 | egrep '^\*\*'
  1271   ** Unknown exception encountered with possibly-broken third-party extension older
  1275   ** Unknown exception encountered with possibly-broken third-party extension older
  1272   ** which supports versions 1.9 of Mercurial.
  1276   ** which supports versions 1.9 of Mercurial.
  1273   ** Please disable older and try your action again.
  1277   ** Please disable older and try your action again.
  1277   ** Extensions loaded: throw, older
  1281   ** Extensions loaded: throw, older
  1278 
  1282 
  1279 Older extension is tested with current version, the other only with newer:
  1283 Older extension is tested with current version, the other only with newer:
  1280   $ echo "util.version = lambda:'1.9.3'" >> older.py
  1284   $ echo "util.version = lambda:'1.9.3'" >> older.py
  1281   $ rm -f older.pyc older.pyo
  1285   $ rm -f older.pyc older.pyo
       
  1286   $ rm -Rf __pycache__
  1282   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
  1287   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
  1283   >   throw 2>&1 | egrep '^\*\*'
  1288   >   throw 2>&1 | egrep '^\*\*'
  1284   ** Unknown exception encountered with possibly-broken third-party extension throw
  1289   ** Unknown exception encountered with possibly-broken third-party extension throw
  1285   ** which supports versions 2.1 of Mercurial.
  1290   ** which supports versions 2.1 of Mercurial.
  1286   ** Please disable throw and try your action again.
  1291   ** Please disable throw and try your action again.
  1303   $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
  1308   $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
  1304   $ if [ -z "$hgver" ]; then
  1309   $ if [ -z "$hgver" ]; then
  1305   >   echo "unable to fetch a mercurial version. Make sure __version__ is correct";
  1310   >   echo "unable to fetch a mercurial version. Make sure __version__ is correct";
  1306   > fi
  1311   > fi
  1307   $ rm -f throw.pyc throw.pyo
  1312   $ rm -f throw.pyc throw.pyo
       
  1313   $ rm -Rf __pycache__
  1308   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
  1314   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
  1309   ** unknown exception encountered, please report by visiting
  1315   ** unknown exception encountered, please report by visiting
  1310   ** https://mercurial-scm.org/wiki/BugTracker
  1316   ** https://mercurial-scm.org/wiki/BugTracker
  1311   ** Python * (glob)
  1317   ** Python * (glob)
  1312   ** Mercurial Distributed SCM (*) (glob)
  1318   ** Mercurial Distributed SCM (*) (glob)
  1314 
  1320 
  1315 Patch version is ignored during compatibility check
  1321 Patch version is ignored during compatibility check
  1316   $ echo "testedwith = '3.2'" >> throw.py
  1322   $ echo "testedwith = '3.2'" >> throw.py
  1317   $ echo "util.version = lambda:'3.2.2'" >> throw.py
  1323   $ echo "util.version = lambda:'3.2.2'" >> throw.py
  1318   $ rm -f throw.pyc throw.pyo
  1324   $ rm -f throw.pyc throw.pyo
       
  1325   $ rm -Rf __pycache__
  1319   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
  1326   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
  1320   ** unknown exception encountered, please report by visiting
  1327   ** unknown exception encountered, please report by visiting
  1321   ** https://mercurial-scm.org/wiki/BugTracker
  1328   ** https://mercurial-scm.org/wiki/BugTracker
  1322   ** Python * (glob)
  1329   ** Python * (glob)
  1323   ** Mercurial Distributed SCM (*) (glob)
  1330   ** Mercurial Distributed SCM (*) (glob)
  1324   ** Extensions loaded: throw
  1331   ** Extensions loaded: throw
  1325 
  1332 
  1326 Test version number support in 'hg version':
  1333 Test version number support in 'hg version':
  1327   $ echo '__version__ = (1, 2, 3)' >> throw.py
  1334   $ echo '__version__ = (1, 2, 3)' >> throw.py
  1328   $ rm -f throw.pyc throw.pyo
  1335   $ rm -f throw.pyc throw.pyo
       
  1336   $ rm -Rf __pycache__
  1329   $ hg version -v
  1337   $ hg version -v
  1330   Mercurial Distributed SCM (version *) (glob)
  1338   Mercurial Distributed SCM (version *) (glob)
  1331   (see https://mercurial-scm.org for more information)
  1339   (see https://mercurial-scm.org for more information)
  1332   
  1340   
  1333   Copyright (C) 2005-* Matt Mackall and others (glob)
  1341   Copyright (C) 2005-* Matt Mackall and others (glob)
  1348   Enabled extensions:
  1356   Enabled extensions:
  1349   
  1357   
  1350     throw  external  1.2.3
  1358     throw  external  1.2.3
  1351   $ echo 'getversion = lambda: "1.twentythree"' >> throw.py
  1359   $ echo 'getversion = lambda: "1.twentythree"' >> throw.py
  1352   $ rm -f throw.pyc throw.pyo
  1360   $ rm -f throw.pyc throw.pyo
       
  1361   $ rm -Rf __pycache__
  1353   $ hg version -v --config extensions.throw=throw.py --config extensions.strip=
  1362   $ hg version -v --config extensions.throw=throw.py --config extensions.strip=
  1354   Mercurial Distributed SCM (version *) (glob)
  1363   Mercurial Distributed SCM (version *) (glob)
  1355   (see https://mercurial-scm.org for more information)
  1364   (see https://mercurial-scm.org for more information)
  1356   
  1365   
  1357   Copyright (C) 2005-* Matt Mackall and others (glob)
  1366   Copyright (C) 2005-* Matt Mackall and others (glob)