comparison tests/test_util.py @ 22:95d0109e495e

Refactor tests so I can reuse code more.
author Augie Fackler <durin42@gmail.com>
date Wed, 08 Oct 2008 20:09:28 -0500
parents 48a44546c12f
children 1f8854804795
comparison
equal deleted inserted replaced
21:8626f3d2e50b 22:95d0109e495e
1 import os 1 import os
2 import popen2 2 import popen2
3
4 from mercurial import ui
5 from mercurial import hg
6
7 import fetch_command
3 8
4 FIXTURES = os.path.join(os.path.abspath(os.path.dirname(__file__)), 9 FIXTURES = os.path.join(os.path.abspath(os.path.dirname(__file__)),
5 'fixtures') 10 'fixtures')
6 11
7 def load_svndump_fixture(path, fixture_name): 12 def load_svndump_fixture(path, fixture_name):
12 proc = popen2.Popen4(['svnadmin', 'load', path,]) 17 proc = popen2.Popen4(['svnadmin', 'load', path,])
13 inp = open(os.path.join(FIXTURES, fixture_name)) 18 inp = open(os.path.join(FIXTURES, fixture_name))
14 proc.tochild.write(inp.read()) 19 proc.tochild.write(inp.read())
15 proc.tochild.close() 20 proc.tochild.close()
16 proc.wait() 21 proc.wait()
22
23 def load_fixture_and_fetch(fixture_name, repo_path, wc_path):
24 load_svndump_fixture(repo_path, fixture_name)
25 fetch_command.fetch_revisions(ui.ui(),
26 svn_url='file://%s' % repo_path,
27 hg_repo_path=wc_path)
28 repo = hg.repository(ui.ui(), wc_path)
29 return repo