tests/test-ui-config.py
author Gregory Szorc <gregory.szorc@gmail.com>
Tue, 10 Apr 2018 14:29:15 -0700
changeset 37557 734515aca84d
parent 37519 3740d1abde44
child 37981 a2cfea193040
permissions -rw-r--r--
wireproto: define and implement HTTP handshake to upgrade protocol When clients connect to repositories over HTTP, they issue a request to the well-known URL "?cmd=capabilities" to fetch the repository capabilities. This is the handshake portion of the HTTP protocol. This commit defines a mechanism to use that HTTP request to return information about modern server features. If a client sends an X-HgUpgrade-* header containing a list of client-supported API names, the server responds with a response containing information about available services. This includes the normal capabilities string. So if the server doesn't support any newer services, the client can easily fall back. By advertising supported services from clients, server operators can see and log what client support exists in the wild. This will also help with debugging. The response contains the base path to API services. We know there are potential issues with the <repo>/api/ URL space conflicting with hgwebdir and subrepos. By making the API URL dynamic from the perspective of the client, the URL for APIs is not subject to backwards compatibility concerns - at least as long as a ?cmd=capabilities request is made. We've also defined the ``cbor`` client capability for the X-HgProto-* header. This MUST be sent in order to get the modern response from "?cmd=capabilities". During implementation, I initially always sent an application/mercurial-cbor response. However, the handshake mechanism will be more future compatible if the client is in charge of which formats to request. We already perform content negotiation from X-HgProto-*, so keying off this for the capabilities response feels appropriate. In addition, I initially used application/cbor. However, it is conceivable that a non-Mercurial server could serve application/cbor. To rule out this possibility, I've invented a new media type that is Mercurial specific and can't be confused for generic CBOR. Differential Revision: https://phab.mercurial-scm.org/D3242
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28681
eda8b28e3b1b py3: make test-ui-config use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28680
diff changeset
     1
from __future__ import absolute_import, print_function
28680
ae606bdedc3e py3: make test-ui-config use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 25660
diff changeset
     2
from mercurial import (
ae606bdedc3e py3: make test-ui-config use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 25660
diff changeset
     3
    dispatch,
ae606bdedc3e py3: make test-ui-config use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 25660
diff changeset
     4
    error,
28776
5508a277bab2 tests: alias ui as uimod in test-ui-config
Yuya Nishihara <yuya@tcha.org>
parents: 28681
diff changeset
     5
    ui as uimod,
28680
ae606bdedc3e py3: make test-ui-config use absolute_import
Pulkit Goyal <7895pulkit@gmail.com>
parents: 25660
diff changeset
     6
)
2502
18cf95ad3666 Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
     7
30564
d83ca854fa21 ui: factor out ui.load() to create a ui without loading configs (API)
Yuya Nishihara <yuya@tcha.org>
parents: 28776
diff changeset
     8
testui = uimod.ui.load()
34858
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 32487
diff changeset
     9
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 32487
diff changeset
    10
# disable the configuration registration warning
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 32487
diff changeset
    11
#
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 32487
diff changeset
    12
# the purpose of this test is to check the old behavior, not to validate the
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 32487
diff changeset
    13
# behavior from registered item. so we silent warning related to unregisted
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 32487
diff changeset
    14
# config.
37519
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    15
testui.setconfig(b'devel', b'warn-config-unknown', False, b'test')
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    16
testui.setconfig(b'devel', b'all-warnings', False, b'test')
34858
85a2db47ad50 configitems: adds a developer warning when accessing undeclared configuration
Boris Feld <boris.feld@octobus.net>
parents: 32487
diff changeset
    17
8137
7fd0616b3d80 ui: kill updateopts
Matt Mackall <mpm@selenic.com>
parents: 5178
diff changeset
    18
parsed = dispatch._parseconfig(testui, [
37519
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    19
    b'values.string=string value',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    20
    b'values.bool1=true',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    21
    b'values.bool2=false',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    22
    b'values.boolinvalid=foo',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    23
    b'values.int1=42',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    24
    b'values.int2=-42',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    25
    b'values.intinvalid=foo',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    26
    b'lists.list1=foo',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    27
    b'lists.list2=foo bar baz',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    28
    b'lists.list3=alice, bob',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    29
    b'lists.list4=foo bar baz alice, bob',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    30
    b'lists.list5=abc d"ef"g "hij def"',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    31
    b'lists.list6="hello world", "how are you?"',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    32
    b'lists.list7=Do"Not"Separate',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    33
    b'lists.list8="Do"Separate',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    34
    b'lists.list9="Do\\"NotSeparate"',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    35
    b'lists.list10=string "with extraneous" quotation mark"',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    36
    b'lists.list11=x, y',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    37
    b'lists.list12="x", "y"',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    38
    b'lists.list13=""" key = "x", "y" """',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    39
    b'lists.list14=,,,,     ',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    40
    b'lists.list15=" just with starting quotation',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    41
    b'lists.list16="longer quotation" with "no ending quotation',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    42
    b'lists.list17=this is \\" "not a quotation mark"',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    43
    b'lists.list18=\n \n\nding\ndong',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    44
    b'date.epoch=0 0',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    45
    b'date.birth=2005-04-19T00:00:00',
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    46
    b'date.invalid=0'
14171
fa2b596db182 ui: add configint function and tests
Sune Foldager <cryo@cyanite.org>
parents: 12865
diff changeset
    47
    ])
2502
18cf95ad3666 Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    48
37519
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    49
print(repr(testui.configitems(b'values')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    50
print(repr(testui.configitems(b'lists')))
28681
eda8b28e3b1b py3: make test-ui-config use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28680
diff changeset
    51
print("---")
37519
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    52
print(repr(testui.config(b'values', b'string')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    53
print(repr(testui.config(b'values', b'bool1')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    54
print(repr(testui.config(b'values', b'bool2')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    55
print(repr(testui.config(b'values', b'unknown')))
28681
eda8b28e3b1b py3: make test-ui-config use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28680
diff changeset
    56
print("---")
2502
18cf95ad3666 Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff changeset
    57
try:
37519
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    58
    print(repr(testui.configbool(b'values', b'string')))
25660
328739ea70c3 global: mass rewrite to use modern exception syntax
Gregory Szorc <gregory.szorc@gmail.com>
parents: 14171
diff changeset
    59
except error.ConfigError as inst:
28681
eda8b28e3b1b py3: make test-ui-config use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28680
diff changeset
    60
    print(inst)
37519
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    61
print(repr(testui.configbool(b'values', b'bool1')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    62
print(repr(testui.configbool(b'values', b'bool2')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    63
print(repr(testui.configbool(b'values', b'bool2', True)))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    64
print(repr(testui.configbool(b'values', b'unknown')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    65
print(repr(testui.configbool(b'values', b'unknown', True)))
28681
eda8b28e3b1b py3: make test-ui-config use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28680
diff changeset
    66
print("---")
37519
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    67
print(repr(testui.configint(b'values', b'int1')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    68
print(repr(testui.configint(b'values', b'int2')))
28681
eda8b28e3b1b py3: make test-ui-config use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28680
diff changeset
    69
print("---")
37519
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    70
print(repr(testui.configlist(b'lists', b'list1')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    71
print(repr(testui.configlist(b'lists', b'list2')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    72
print(repr(testui.configlist(b'lists', b'list3')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    73
print(repr(testui.configlist(b'lists', b'list4')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    74
print(repr(testui.configlist(b'lists', b'list4', [b'foo'])))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    75
print(repr(testui.configlist(b'lists', b'list5')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    76
print(repr(testui.configlist(b'lists', b'list6')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    77
print(repr(testui.configlist(b'lists', b'list7')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    78
print(repr(testui.configlist(b'lists', b'list8')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    79
print(repr(testui.configlist(b'lists', b'list9')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    80
print(repr(testui.configlist(b'lists', b'list10')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    81
print(repr(testui.configlist(b'lists', b'list11')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    82
print(repr(testui.configlist(b'lists', b'list12')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    83
print(repr(testui.configlist(b'lists', b'list13')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    84
print(repr(testui.configlist(b'lists', b'list14')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    85
print(repr(testui.configlist(b'lists', b'list15')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    86
print(repr(testui.configlist(b'lists', b'list16')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    87
print(repr(testui.configlist(b'lists', b'list17')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    88
print(repr(testui.configlist(b'lists', b'list18')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    89
print(repr(testui.configlist(b'lists', b'unknown')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    90
print(repr(testui.configlist(b'lists', b'unknown', b'')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    91
print(repr(testui.configlist(b'lists', b'unknown', b'foo')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    92
print(repr(testui.configlist(b'lists', b'unknown', [b'foo'])))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    93
print(repr(testui.configlist(b'lists', b'unknown', b'foo bar')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    94
print(repr(testui.configlist(b'lists', b'unknown', b'foo, bar')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    95
print(repr(testui.configlist(b'lists', b'unknown', [b'foo bar'])))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    96
print(repr(testui.configlist(b'lists', b'unknown', [b'foo', b'bar'])))
32487
0ed730f3301c ui: fix ui.configdate for invalid dates
Boris Feld <boris.feld@octobus.net>
parents: 30564
diff changeset
    97
print("---")
37519
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    98
print(repr(testui.configdate(b'date', b'epoch')))
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
    99
print(repr(testui.configdate(b'date', b'birth')))
4069
3fef134832d8 allow values that aren't strings in util.configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3346
diff changeset
   100
37519
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
   101
print(repr(testui.config(b'values', b'String')))
4069
3fef134832d8 allow values that aren't strings in util.configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3346
diff changeset
   102
3fef134832d8 allow values that aren't strings in util.configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3346
diff changeset
   103
def function():
3fef134832d8 allow values that aren't strings in util.configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3346
diff changeset
   104
    pass
3fef134832d8 allow values that aren't strings in util.configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3346
diff changeset
   105
3fef134832d8 allow values that aren't strings in util.configparser
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 3346
diff changeset
   106
# values that aren't strings should work
37519
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
   107
testui.setconfig(b'hook', b'commit', function)
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
   108
print(function == testui.config(b'hook', b'commit'))
14171
fa2b596db182 ui: add configint function and tests
Sune Foldager <cryo@cyanite.org>
parents: 12865
diff changeset
   109
fa2b596db182 ui: add configint function and tests
Sune Foldager <cryo@cyanite.org>
parents: 12865
diff changeset
   110
# invalid values
fa2b596db182 ui: add configint function and tests
Sune Foldager <cryo@cyanite.org>
parents: 12865
diff changeset
   111
try:
37519
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
   112
    testui.configbool(b'values', b'boolinvalid')
14171
fa2b596db182 ui: add configint function and tests
Sune Foldager <cryo@cyanite.org>
parents: 12865
diff changeset
   113
except error.ConfigError:
28681
eda8b28e3b1b py3: make test-ui-config use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28680
diff changeset
   114
    print('boolinvalid')
14171
fa2b596db182 ui: add configint function and tests
Sune Foldager <cryo@cyanite.org>
parents: 12865
diff changeset
   115
try:
37519
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
   116
    testui.configint(b'values', b'intinvalid')
14171
fa2b596db182 ui: add configint function and tests
Sune Foldager <cryo@cyanite.org>
parents: 12865
diff changeset
   117
except error.ConfigError:
28681
eda8b28e3b1b py3: make test-ui-config use print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28680
diff changeset
   118
    print('intinvalid')
32487
0ed730f3301c ui: fix ui.configdate for invalid dates
Boris Feld <boris.feld@octobus.net>
parents: 30564
diff changeset
   119
try:
37519
3740d1abde44 py3: add b'' prefixes in tests/test-ui-config.py
Pulkit Goyal <7895pulkit@gmail.com>
parents: 34858
diff changeset
   120
    testui.configdate(b'date', b'invalid')
32487
0ed730f3301c ui: fix ui.configdate for invalid dates
Boris Feld <boris.feld@octobus.net>
parents: 30564
diff changeset
   121
except error.ConfigError:
0ed730f3301c ui: fix ui.configdate for invalid dates
Boris Feld <boris.feld@octobus.net>
parents: 30564
diff changeset
   122
    print('dateinvalid')