annotate tests/test-propertycache.py @ 50329:3dbc7b1ecaba stable

typing: correct the signature of error.CommandError There's a place in `mercurial.dispatch._parse()` that passes None if a parse error happens before the command can be parsed out, and casting the error to bytes works fine because the command and message fields are apparently ignored. Likewise, TortoiseHg similarly passes None for the same reason.
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 24 Mar 2023 02:22:12 -0400
parents 6000f5b25c9b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
1 """test behavior of propertycache and unfiltered propertycache
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
2
19951
d51c4d85ec23 spelling: random spell checker fixes
Mads Kiilerich <madski@unity3d.com>
parents: 19878
diff changeset
3 The repoview overlay is quite complex. We test the behavior of
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
4 property cache of both localrepo and repoview to prevent
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
5 regression."""
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
6
28755
84673a7c54af py3: use absolute_import in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 21024
diff changeset
7 import os
84673a7c54af py3: use absolute_import in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 21024
diff changeset
8 import subprocess
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
9
28839
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
10 from mercurial import (
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
11 hg,
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
12 localrepo,
40297
d33611280add py3: fix test-propertycache.py
Mark Thomas <mbthomas@fb.com>
parents: 30559
diff changeset
13 pycompat,
28839
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
14 ui as uimod,
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
15 util,
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
16 )
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
17
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
18 from mercurial.utils import procutil
40347
e5d74742d00e py3: fix test-propertycache.py on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 40297
diff changeset
19
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
20 # create some special property cache that trace they call
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
21
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
22 calllog = []
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
23
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
24
28839
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
25 @util.propertycache
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
26 def testcachedfoobar(repo):
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
27 name = repo.filtername
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
28 if name is None:
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
29 name = ''
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
30 val = len(name)
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
31 calllog.append(val)
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
32 return val
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
33
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
34
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
35 unficalllog = []
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
36
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
37
28839
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
38 @localrepo.unfilteredpropertycache
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
39 def testcachedunfifoobar(repo):
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
40 name = repo.filtername
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
41 if name is None:
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
42 name = ''
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
43 val = 100 + len(name)
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
44 unficalllog.append(val)
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
45 return val
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
46
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
47
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
48 # plug them on repo
28839
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
49 localrepo.localrepository.testcachedfoobar = testcachedfoobar
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
50 localrepo.localrepository.testcachedunfifoobar = testcachedunfifoobar
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
51
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
52
21024
7731a2281cf0 spelling: fixes from spell checker
Mads Kiilerich <madski@unity3d.com>
parents: 19951
diff changeset
53 # Create an empty repo and instantiate it. It is important to run
7731a2281cf0 spelling: fixes from spell checker
Mads Kiilerich <madski@unity3d.com>
parents: 19951
diff changeset
54 # these tests on the real object to detect regression.
40297
d33611280add py3: fix test-propertycache.py
Mark Thomas <mbthomas@fb.com>
parents: 30559
diff changeset
55 repopath = pycompat.fsencode(os.path.join(os.environ['TESTTMP'], 'repo'))
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
56 assert (
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
57 subprocess.call(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
58 pycompat.rapply(procutil.tonativestr, [b'hg', b'init', repopath])
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
59 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
60 == 0
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
61 )
40347
e5d74742d00e py3: fix test-propertycache.py on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 40297
diff changeset
62
30559
d83ca854fa21 ui: factor out ui.load() to create a ui without loading configs (API)
Yuya Nishihara <yuya@tcha.org>
parents: 28839
diff changeset
63 ui = uimod.ui.load()
28839
de7802c3a1df tests: import mercurial modules by name in test-propertycache
Yuya Nishihara <yuya@tcha.org>
parents: 28838
diff changeset
64 repo = hg.repository(ui, path=repopath).unfiltered()
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
65
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
66
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
67 print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
68 print('=== property cache ===')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
69 print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
70 print('calllog:', calllog)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
71 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
72 'cached value (unfiltered):', vars(repo).get('testcachedfoobar', 'NOCACHE')
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
73 )
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
74
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
75 print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
76 print('= first access on unfiltered, should do a call')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
77 print('access:', repo.testcachedfoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
78 print('calllog:', calllog)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
79 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
80 'cached value (unfiltered):', vars(repo).get('testcachedfoobar', 'NOCACHE')
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
81 )
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
82
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
83 print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
84 print('= second access on unfiltered, should not do call')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
85 print('access', repo.testcachedfoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
86 print('calllog:', calllog)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
87 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
88 'cached value (unfiltered):', vars(repo).get('testcachedfoobar', 'NOCACHE')
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
89 )
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
90
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
91 print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
92 print('= first access on "visible" view, should do a call')
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
93 visibleview = repo.filtered('visible')
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
94 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
95 'cached value ("visible" view):',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
96 vars(visibleview).get('testcachedfoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
97 )
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
98 print('access:', visibleview.testcachedfoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
99 print('calllog:', calllog)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
100 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
101 'cached value (unfiltered):', vars(repo).get('testcachedfoobar', 'NOCACHE')
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
102 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
103 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
104 'cached value ("visible" view):',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
105 vars(visibleview).get('testcachedfoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
106 )
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
107
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
108 print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
109 print('= second access on "visible view", should not do call')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
110 print('access:', visibleview.testcachedfoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
111 print('calllog:', calllog)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
112 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
113 'cached value (unfiltered):', vars(repo).get('testcachedfoobar', 'NOCACHE')
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
114 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
115 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
116 'cached value ("visible" view):',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
117 vars(visibleview).get('testcachedfoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
118 )
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
119
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
120 print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
121 print('= no effect on other view')
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
122 immutableview = repo.filtered('immutable')
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
123 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
124 'cached value ("immutable" view):',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
125 vars(immutableview).get('testcachedfoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
126 )
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
127 print('access:', immutableview.testcachedfoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
128 print('calllog:', calllog)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
129 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
130 'cached value (unfiltered):', vars(repo).get('testcachedfoobar', 'NOCACHE')
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
131 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
132 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
133 'cached value ("visible" view):',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
134 vars(visibleview).get('testcachedfoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
135 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
136 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
137 'cached value ("immutable" view):',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
138 vars(immutableview).get('testcachedfoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
139 )
19845
a1237a4b437d repoview: make propertycache.setcache compatible with repoview
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
140
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
141 # unfiltered property cache test
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
142 print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
143 print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
144 print('=== unfiltered property cache ===')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
145 print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
146 print('unficalllog:', unficalllog)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
147 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
148 'cached value (unfiltered): ',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
149 vars(repo).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
150 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
151 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
152 'cached value ("visible" view): ',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
153 vars(visibleview).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
154 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
155 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
156 'cached value ("immutable" view):',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
157 vars(immutableview).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
158 )
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
159
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
160 print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
161 print('= first access on unfiltered, should do a call')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
162 print('access (unfiltered):', repo.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
163 print('unficalllog:', unficalllog)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
164 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
165 'cached value (unfiltered): ',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
166 vars(repo).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
167 )
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
168
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
169 print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
170 print('= second access on unfiltered, should not do call')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
171 print('access (unfiltered):', repo.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
172 print('unficalllog:', unficalllog)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
173 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
174 'cached value (unfiltered): ',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
175 vars(repo).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
176 )
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
177
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
178 print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
179 print('= access on view should use the unfiltered cache')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
180 print('access (unfiltered): ', repo.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
181 print('access ("visible" view): ', visibleview.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
182 print('access ("immutable" view):', immutableview.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
183 print('unficalllog:', unficalllog)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
184 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
185 'cached value (unfiltered): ',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
186 vars(repo).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
187 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
188 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
189 'cached value ("visible" view): ',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
190 vars(visibleview).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
191 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
192 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
193 'cached value ("immutable" view):',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
194 vars(immutableview).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
195 )
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
196
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
197 print('')
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
198 print('= even if we clear the unfiltered cache')
19846
9789670992d6 repoview: have unfilteredpropertycache using the underlying cache
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 19845
diff changeset
199 del repo.__dict__['testcachedunfifoobar']
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
200 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
201 'cached value (unfiltered): ',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
202 vars(repo).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
203 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
204 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
205 'cached value ("visible" view): ',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
206 vars(visibleview).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
207 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
208 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
209 'cached value ("immutable" view):',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
210 vars(immutableview).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
211 )
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
212 print('unficalllog:', unficalllog)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
213 print('access ("visible" view): ', visibleview.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
214 print('unficalllog:', unficalllog)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
215 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
216 'cached value (unfiltered): ',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
217 vars(repo).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
218 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
219 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
220 'cached value ("visible" view): ',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
221 vars(visibleview).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
222 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
223 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
224 'cached value ("immutable" view):',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
225 vars(immutableview).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
226 )
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
227 print('access ("immutable" view):', immutableview.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
228 print('unficalllog:', unficalllog)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
229 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
230 'cached value (unfiltered): ',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
231 vars(repo).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
232 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
233 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
234 'cached value ("visible" view): ',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
235 vars(visibleview).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
236 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
237 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
238 'cached value ("immutable" view):',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
239 vars(immutableview).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
240 )
28762
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
241 print('access (unfiltered): ', repo.testcachedunfifoobar)
61ba04ae6a2f py3: use print_function in test-propertycache.py
Robert Stanca <robert.stanca7@gmail.com>
parents: 28755
diff changeset
242 print('unficalllog:', unficalllog)
43076
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
243 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
244 'cached value (unfiltered): ',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
245 vars(repo).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
246 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
247 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
248 'cached value ("visible" view): ',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
249 vars(visibleview).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
250 )
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
251 print(
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
252 'cached value ("immutable" view):',
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
253 vars(immutableview).get('testcachedunfifoobar', 'NOCACHE'),
2372284d9457 formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents: 40347
diff changeset
254 )