tests/test-check-py3-commands.t
author Jun Wu <quark@fb.com>
Mon, 20 Mar 2017 15:28:08 -0700
changeset 31565 9639ff4a93ae
parent 31530 935a1b1117c7
child 31612 aea8ec3f7dd1
permissions -rw-r--r--
setup: split "hasfunction" to test arbitrary code The next patch wants to test include files.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30129
d69d86e7d6c8 py3: test to check which commands run
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     1
#require py3exe
d69d86e7d6c8 py3: test to check which commands run
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     2
d69d86e7d6c8 py3: test to check which commands run
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     3
This test helps in keeping a track on which commands we can run on
d69d86e7d6c8 py3: test to check which commands run
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     4
Python 3 and see what kind of errors are coming up.
d69d86e7d6c8 py3: test to check which commands run
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     5
The full traceback is hidden to have a stable output.
31385
3690c75f4d1e tests: make a variable for hg binary location in test-check-py3-commands
Augie Fackler <augie@google.com>
parents: 31370
diff changeset
     6
  $ HGBIN=`which hg`
30129
d69d86e7d6c8 py3: test to check which commands run
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     7
d69d86e7d6c8 py3: test to check which commands run
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     8
  $ for cmd in version debuginstall ; do
d69d86e7d6c8 py3: test to check which commands run
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     9
  >   echo $cmd
31385
3690c75f4d1e tests: make a variable for hg binary location in test-check-py3-commands
Augie Fackler <augie@google.com>
parents: 31370
diff changeset
    10
  >   $PYTHON3 $HGBIN $cmd 2>&1 2>&1 | tail -1
30129
d69d86e7d6c8 py3: test to check which commands run
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    11
  > done
d69d86e7d6c8 py3: test to check which commands run
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    12
  version
30591
2d555d753f0e py3: make keys of keyword arguments strings
Pulkit Goyal <7895pulkit@gmail.com>
parents: 30574
diff changeset
    13
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
30129
d69d86e7d6c8 py3: test to check which commands run
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    14
  debuginstall
31317
62939e0148f1 policy: try and always have a bytes for module policy
Augie Fackler <raf@durin42.com>
parents: 31313
diff changeset
    15
  no problems detected
31313
dab92f3dbd98 py3: add a test that proves %include and missing-extension code works
Augie Fackler <raf@durin42.com>
parents: 30591
diff changeset
    16
31386
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    17
#if test-repo
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    18
Make a clone so that any features in the developer's .hg/hgrc that
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    19
might confuse Python 3 don't break this test. When we can do commit in
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    20
Python 3, we'll stop doing this. We use e76ed1e480ef for the clone
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    21
because it has different files than 273ce12ad8f1, so we can test both
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    22
`files` from dirstate and `files` loaded from a specific revision.
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    23
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    24
  $ hg clone -r e76ed1e480ef "`dirname "$TESTDIR"`" testrepo 2>&1 | tail -1
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    25
  15 files updated, 0 files merged, 0 files removed, 0 files unresolved
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    26
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    27
Test using -R, which exercises some URL code:
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    28
  $ $PYTHON3 $HGBIN -R testrepo files -r 273ce12ad8f1 | tail -1
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    29
  testrepo/tkmerge
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    30
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    31
Now prove `hg files` is reading the whole manifest. We have to grep
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    32
out some potential warnings that come from hgrc as yet.
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    33
  $ cd testrepo
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    34
  $ $PYTHON3 $HGBIN files -r 273ce12ad8f1
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    35
  .hgignore
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    36
  PKG-INFO
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    37
  README
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    38
  hg
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    39
  mercurial/__init__.py
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    40
  mercurial/byterange.py
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    41
  mercurial/fancyopts.py
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    42
  mercurial/hg.py
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    43
  mercurial/mdiff.py
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    44
  mercurial/revlog.py
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    45
  mercurial/transaction.py
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    46
  notes.txt
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    47
  setup.py
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    48
  tkmerge
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    49
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    50
  $ $PYTHON3 $HGBIN files -r 273ce12ad8f1 | wc -l
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    51
  \s*14 (re)
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    52
  $ $PYTHON3 $HGBIN files | wc -l
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    53
  \s*15 (re)
31459
b3b4c487707c py3: prove hg tip works
Yuya Nishihara <yuya@tcha.org>
parents: 31410
diff changeset
    54
31494
a992caaf0e22 py3: convert log opts to bytes-key dict
Yuya Nishihara <yuya@tcha.org>
parents: 31459
diff changeset
    55
Test if log-like commands work:
31459
b3b4c487707c py3: prove hg tip works
Yuya Nishihara <yuya@tcha.org>
parents: 31410
diff changeset
    56
b3b4c487707c py3: prove hg tip works
Yuya Nishihara <yuya@tcha.org>
parents: 31410
diff changeset
    57
  $ $PYTHON3 $HGBIN tip
b3b4c487707c py3: prove hg tip works
Yuya Nishihara <yuya@tcha.org>
parents: 31410
diff changeset
    58
  changeset:   10:e76ed1e480ef
b3b4c487707c py3: prove hg tip works
Yuya Nishihara <yuya@tcha.org>
parents: 31410
diff changeset
    59
  tag:         tip
b3b4c487707c py3: prove hg tip works
Yuya Nishihara <yuya@tcha.org>
parents: 31410
diff changeset
    60
  user:        oxymoron@cinder.waste.org
b3b4c487707c py3: prove hg tip works
Yuya Nishihara <yuya@tcha.org>
parents: 31410
diff changeset
    61
  date:        Tue May 03 23:37:43 2005 -0800
b3b4c487707c py3: prove hg tip works
Yuya Nishihara <yuya@tcha.org>
parents: 31410
diff changeset
    62
  summary:     Fix linking of changeset revs when merging
b3b4c487707c py3: prove hg tip works
Yuya Nishihara <yuya@tcha.org>
parents: 31410
diff changeset
    63
  
b3b4c487707c py3: prove hg tip works
Yuya Nishihara <yuya@tcha.org>
parents: 31410
diff changeset
    64
31494
a992caaf0e22 py3: convert log opts to bytes-key dict
Yuya Nishihara <yuya@tcha.org>
parents: 31459
diff changeset
    65
  $ $PYTHON3 $HGBIN log -r0
a992caaf0e22 py3: convert log opts to bytes-key dict
Yuya Nishihara <yuya@tcha.org>
parents: 31459
diff changeset
    66
  changeset:   0:9117c6561b0b
a992caaf0e22 py3: convert log opts to bytes-key dict
Yuya Nishihara <yuya@tcha.org>
parents: 31459
diff changeset
    67
  user:        mpm@selenic.com
a992caaf0e22 py3: convert log opts to bytes-key dict
Yuya Nishihara <yuya@tcha.org>
parents: 31459
diff changeset
    68
  date:        Tue May 03 13:16:10 2005 -0800
a992caaf0e22 py3: convert log opts to bytes-key dict
Yuya Nishihara <yuya@tcha.org>
parents: 31459
diff changeset
    69
  summary:     Add back links from file revisions to changeset revisions
a992caaf0e22 py3: convert log opts to bytes-key dict
Yuya Nishihara <yuya@tcha.org>
parents: 31459
diff changeset
    70
  
31530
935a1b1117c7 py3: prove hg status works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31528
diff changeset
    71
Test if `hg status` works:
935a1b1117c7 py3: prove hg status works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31528
diff changeset
    72
935a1b1117c7 py3: prove hg status works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31528
diff changeset
    73
  $ mkdir a b a/1 b/1 b/2
935a1b1117c7 py3: prove hg status works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31528
diff changeset
    74
  $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
935a1b1117c7 py3: prove hg status works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31528
diff changeset
    75
  $ $PYTHON3 $HGBIN status
935a1b1117c7 py3: prove hg status works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31528
diff changeset
    76
  ? a/1/in_a_1
935a1b1117c7 py3: prove hg status works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31528
diff changeset
    77
  ? a/in_a
935a1b1117c7 py3: prove hg status works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31528
diff changeset
    78
  ? b/1/in_b_1
935a1b1117c7 py3: prove hg status works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31528
diff changeset
    79
  ? b/2/in_b_2
935a1b1117c7 py3: prove hg status works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31528
diff changeset
    80
  ? b/in_b
935a1b1117c7 py3: prove hg status works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31528
diff changeset
    81
  ? in_root
31494
a992caaf0e22 py3: convert log opts to bytes-key dict
Yuya Nishihara <yuya@tcha.org>
parents: 31459
diff changeset
    82
31386
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    83
  $ cd ..
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    84
#endif
52ee1b5ac277 py3: prove `hg files --rev` works
Augie Fackler <augie@google.com>
parents: 31385
diff changeset
    85
31528
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
    86
Test if `hg config` works:
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
    87
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
    88
  $ $PYTHON3 $HGBIN config
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
    89
  defaults.backout=-d "0 0"
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
    90
  defaults.commit=-d "0 0"
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
    91
  defaults.shelve=--date "0 0"
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
    92
  defaults.tag=-d "0 0"
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
    93
  devel.all-warnings=true
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
    94
  largefiles.usercache=$TESTTMP/.cache/largefiles
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
    95
  ui.slash=True
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
    96
  ui.interactive=False
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
    97
  ui.mergemarkers=detailed
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
    98
  ui.promptecho=True
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
    99
  web.address=localhost
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
   100
  web.ipv6=False
23fc9b98445f py3: prove hg config works
Rishabh Madan <rishabhmadan96@gmail.com>
parents: 31494
diff changeset
   101
31313
dab92f3dbd98 py3: add a test that proves %include and missing-extension code works
Augie Fackler <raf@durin42.com>
parents: 30591
diff changeset
   102
  $ cat > included-hgrc <<EOF
dab92f3dbd98 py3: add a test that proves %include and missing-extension code works
Augie Fackler <raf@durin42.com>
parents: 30591
diff changeset
   103
  > [extensions]
dab92f3dbd98 py3: add a test that proves %include and missing-extension code works
Augie Fackler <raf@durin42.com>
parents: 30591
diff changeset
   104
  > babar = imaginary_elephant
dab92f3dbd98 py3: add a test that proves %include and missing-extension code works
Augie Fackler <raf@durin42.com>
parents: 30591
diff changeset
   105
  > EOF
dab92f3dbd98 py3: add a test that proves %include and missing-extension code works
Augie Fackler <raf@durin42.com>
parents: 30591
diff changeset
   106
  $ cat >> $HGRCPATH <<EOF
dab92f3dbd98 py3: add a test that proves %include and missing-extension code works
Augie Fackler <raf@durin42.com>
parents: 30591
diff changeset
   107
  > %include $TESTTMP/included-hgrc
dab92f3dbd98 py3: add a test that proves %include and missing-extension code works
Augie Fackler <raf@durin42.com>
parents: 30591
diff changeset
   108
  > EOF
31385
3690c75f4d1e tests: make a variable for hg binary location in test-check-py3-commands
Augie Fackler <augie@google.com>
parents: 31370
diff changeset
   109
  $ $PYTHON3 $HGBIN version | tail -1
31313
dab92f3dbd98 py3: add a test that proves %include and missing-extension code works
Augie Fackler <raf@durin42.com>
parents: 30591
diff changeset
   110
  *** failed to import extension babar from imaginary_elephant: *: 'imaginary_elephant' (glob)
dab92f3dbd98 py3: add a test that proves %include and missing-extension code works
Augie Fackler <raf@durin42.com>
parents: 30591
diff changeset
   111
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
31370
8a17c541177f py3: add "b" prefix to string literals related to module policy
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 31317
diff changeset
   112
31407
d785fed7c115 tests: clean up bad extension
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31386
diff changeset
   113
  $ rm included-hgrc
d785fed7c115 tests: clean up bad extension
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31386
diff changeset
   114
  $ touch included-hgrc
d785fed7c115 tests: clean up bad extension
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31386
diff changeset
   115
31370
8a17c541177f py3: add "b" prefix to string literals related to module policy
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 31317
diff changeset
   116
Test bytes-ness of policy.policy with HGMODULEPOLICY
8a17c541177f py3: add "b" prefix to string literals related to module policy
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 31317
diff changeset
   117
8a17c541177f py3: add "b" prefix to string literals related to module policy
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 31317
diff changeset
   118
  $ HGMODULEPOLICY=py
8a17c541177f py3: add "b" prefix to string literals related to module policy
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 31317
diff changeset
   119
  $ export HGMODULEPOLICY
8a17c541177f py3: add "b" prefix to string literals related to module policy
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 31317
diff changeset
   120
  $ $PYTHON3 `which hg` debuginstall 2>&1 2>&1 | tail -1
8a17c541177f py3: add "b" prefix to string literals related to module policy
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 31317
diff changeset
   121
  no problems detected
31410
ed23f929af38 tests: prove that `hg init` works with Python 3
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31407
diff changeset
   122
ed23f929af38 tests: prove that `hg init` works with Python 3
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31407
diff changeset
   123
`hg init` can create empty repos
ed23f929af38 tests: prove that `hg init` works with Python 3
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31407
diff changeset
   124
ed23f929af38 tests: prove that `hg init` works with Python 3
Gregory Szorc <gregory.szorc@gmail.com>
parents: 31407
diff changeset
   125
  $ $PYTHON3 `which hg` init emptyrepo