Mercurial > hgsubversion
annotate tests/comprehensive/test_obsstore_on.py @ 1539:0ebcc5bbf692
tests: when making a `memctx`, make sure to use a single repo instance
The way self.repo is dynamic produces bad lock behavior because the
`context.memctx` ends up with a different instance than self in
`localrepo.commitctx`, which means the callbacks in the `memctx` get
an unlocked repo instance. This causes lock warning failures. When
it's not a code freeze for core, we should probably:
* Make lock failures hard, not just warnings
* Stop holding a repo reference in memctx, or otherwise check it's the same
instance as `self` during `localrepo.commitctx`
That's my best guess based on the (very hard to debug) test failures here.
| author | Augie Fackler <raf@durin42.com> |
|---|---|
| date | Sat, 28 Oct 2017 21:34:52 -0400 |
| parents | fbc22592f4fa |
| children |
| rev | line source |
|---|---|
|
1516
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
1 import os |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
2 import sys |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
3 |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
4 # wrapped in a try/except because of weirdness in how |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
5 # run.py works as compared to nose. |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
6 try: |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
7 import test_util |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
8 except ImportError: |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
9 sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
10 import test_util |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
11 |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
12 import test_push_command |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
13 |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
14 |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
15 class ObsstoreOnMixIn(object): |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
16 # do not double the test size by being wrapped again |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
17 obsolete_mode_tests = False |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
18 stupid_mode_tests = False |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
19 |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
20 def setUp(self): |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
21 super(ObsstoreOnMixIn, self).setUp() |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
22 hgrcpath = os.environ.get('HGRCPATH') |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
23 assert hgrcpath |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
24 with open(hgrcpath, 'a') as f: |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
25 f.write('\n[experimental]\nevolution=createmarkers\n') |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
26 |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
27 def shortDescription(self): |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
28 text = super(ObsstoreOnMixIn, self).shortDescription() |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
29 if text: |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
30 text += ' (obsstore on)' |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
31 return text |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
32 |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
33 |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
34 def buildtestclass(cls): |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
35 name = 'ObsstoreOn%s' % cls.__name__ |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
36 newcls = type(name, (ObsstoreOnMixIn, cls,), {}) |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
37 globals()[name] = newcls |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
38 |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
39 |
|
fbc22592f4fa
push: lock repo before calling createmarkers
Jun Wu <quark@fb.com>
parents:
diff
changeset
|
40 buildtestclass(test_push_command.PushTests) |
