Mercurial > python-hglib
comparison tests/test-update.py @ 118:e738d6fe5f3f 1.1
tests: make the tests work under Pypy (issue3965)
..which needs explicit close() due to lack of reference counting.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 23 Jun 2013 17:52:16 -0500 |
parents | 8867908fe8c7 |
children | 1b47146a4a2c |
comparison
equal
deleted
inserted
replaced
117:59cb26bf866e | 118:e738d6fe5f3f |
---|---|
31 rev2, node2 = self.client.commit('third') | 31 rev2, node2 = self.client.commit('third') |
32 self.append('a', 'b') | 32 self.append('a', 'b') |
33 self.client.commit('fourth') | 33 self.client.commit('fourth') |
34 self.client.update(rev2) | 34 self.client.update(rev2) |
35 old = open('a').read() | 35 old = open('a').read() |
36 open('a', 'wb').write('a' + old) | 36 f = open('a', 'wb') |
37 f.write('a' + old) | |
38 f.close() | |
37 u, m, r, ur = self.client.update() | 39 u, m, r, ur = self.client.update() |
38 self.assertEquals(u, 0) | 40 self.assertEquals(u, 0) |
39 self.assertEquals(m, 1) | 41 self.assertEquals(m, 1) |
40 self.assertEquals(r, 0) | 42 self.assertEquals(r, 0) |
41 self.assertEquals(ur, 0) | 43 self.assertEquals(ur, 0) |
66 u, m, r, ur = self.client.update(clean=True) | 68 u, m, r, ur = self.client.update(clean=True) |
67 self.assertEquals(u, 1) | 69 self.assertEquals(u, 1) |
68 self.assertEquals(old, open('a').read()) | 70 self.assertEquals(old, open('a').read()) |
69 | 71 |
70 def test_basic_plain(self): | 72 def test_basic_plain(self): |
71 open('.hg/hgrc', 'a').write('[defaults]\nupdate=-v\n') | 73 f = open('.hg/hgrc', 'a') |
74 f.write('[defaults]\nupdate=-v\n') | |
75 f.close() | |
72 self.test_basic() | 76 self.test_basic() |
73 | 77 |
74 def test_largefiles(self): | 78 def test_largefiles(self): |
75 import os | 79 import os |
76 open('.hg/hgrc', 'a').write('[extensions]\nlargefiles=\n') | 80 f = open('.hg/hgrc', 'a') |
81 f.write('[extensions]\nlargefiles=\n') | |
82 f.close() | |
77 self.append('b', 'a') | 83 self.append('b', 'a') |
78 try: | 84 try: |
79 self.client.rawcommand(['add', 'b', '--large']) | 85 self.client.rawcommand(['add', 'b', '--large']) |
80 except error.CommandError: | 86 except error.CommandError: |
81 return | 87 return |