Mercurial > hgsubversion
changeset 337:46e69be8e2c8
Reorganize to have a more conventional module structure.
This means that hgsubversion now uses absolute imports instead of
relative ones, which makes the tests more reliable.
line wrap: on
line diff
rename from __init__.py rename to hgsubversion/__init__.py --- a/__init__.py +++ b/hgsubversion/__init__.py @@ -87,14 +87,14 @@ def uisetup(ui): 'name mapping used for sources)'), ('T', 'tagpaths', ['tags'], 'list of paths to search for tags ' 'in Subversion repositories.')) - extname = __package__.split('_')[-1] + extname = 'hgsubversion' for command in ['clone']: doc = wrapper.__doc__.strip() % { 'extension': extname } getattr(commands, command).__doc__ += doc entry = extensions.wrapcommand(commands.table, command, wrapper) entry[1].extend(newflags) - + try: rebase = extensions.find('rebase') if rebase:
rename from svnwrap/tests/fixtures/project_root_at_repo_root.svndump rename to hgsubversion/svnwrap/tests/fixtures/project_root_at_repo_root.svndump
rename from svnwrap/tests/fixtures/project_root_not_repo_root.svndump rename to hgsubversion/svnwrap/tests/fixtures/project_root_not_repo_root.svndump
--- a/setup.py +++ b/setup.py @@ -23,8 +23,7 @@ setup( long_description = open(os.path.join(os.path.dirname(__file__), 'README')).read(), keywords = 'mercurial', - packages = ['hgext.hgsubversion', 'hgext.hgsubversion.svnwrap'], - package_dir = {'hgext.hgsubversion': ''}, + packages = ['hgsubversion', 'hgsubversion.svnwrap'], platforms = 'any', classifiers = [ 'License :: OSI Approved :: GNU General Public License (GPL)',
--- a/tests/run.py +++ b/tests/run.py @@ -2,7 +2,7 @@ import os import sys import unittest -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import test_binaryfiles import test_diff
--- a/tests/test_diff.py +++ b/tests/test_diff.py @@ -2,7 +2,7 @@ import unittest from mercurial import ui -import wrappers +from hgsubversion import wrappers import test_util
--- a/tests/test_externals.py +++ b/tests/test_externals.py @@ -2,7 +2,7 @@ import os, unittest from mercurial import commands -import svnexternals +from hgsubversion import svnexternals import test_util class TestFetchExternals(test_util.TestBase): @@ -47,7 +47,7 @@ class TestFetchExternals(test_util.TestB ('http://svn.example.com/skin-maker@21 third-party/skins/toolkit', ('third-party/skins/toolkit', None, 'http://svn.example.com/skin-maker', '21')), ] - + for line, expected in samples: self.assertEqual(expected, svnexternals.parsedefinition(line)) @@ -106,7 +106,7 @@ class TestFetchExternals(test_util.TestB svnexternals.updateexternals(ui, [rev], repo) for d in deps: p = os.path.join(repo.root, d) - self.assertTrue(os.path.isdir(p), + self.assertTrue(os.path.isdir(p), 'missing: %s@%r' % (d, rev)) for d in nodeps: p = os.path.join(repo.root, d) @@ -118,10 +118,10 @@ class TestFetchExternals(test_util.TestB commands.update(ui, repo) checkdeps(['deps/project1'], [], repo, 0) checkdeps(['deps/project1', 'deps/project2'], [], repo, 1) - checkdeps(['subdir/deps/project1', 'subdir2/deps/project1', - 'deps/project2'], + checkdeps(['subdir/deps/project1', 'subdir2/deps/project1', + 'deps/project2'], ['deps/project1'], repo, 2) - checkdeps(['subdir/deps/project1', 'deps/project2'], + checkdeps(['subdir/deps/project1', 'deps/project2'], ['subdir2/deps/project1'], repo, 3) checkdeps(['subdir/deps/project1'], ['deps/project2'], repo, 4)
--- a/tests/test_fetch_branches.py +++ b/tests/test_fetch_branches.py @@ -74,10 +74,10 @@ class TestFetchBranches(test_util.TestBa stupid, noupdate=False) self.assertEqual(repo[None].branch(), 'default') self.assertTrue('tip' not in repo[None].tags()) - + def test_branch_tip_update_to_default_stupid(self): self.test_branch_tip_update_to_default(True) - + def test_branch_tip_update_to_branch_anchor(self): repo = self._load_fixture_and_fetch_with_anchor( 'unorderedbranch.svndump', 'branch')
--- a/tests/test_fetch_command_regexes.py +++ b/tests/test_fetch_command_regexes.py @@ -1,6 +1,8 @@ -import stupid import unittest +from hgsubversion import stupid + + two_empties = """Index: __init__.py =================================================================== Index: bar/__init__.py
--- a/tests/test_push_command.py +++ b/tests/test_push_command.py @@ -63,6 +63,8 @@ class PushTests(test_util.TestBase): self.svnserve_pid = subprocess.Popen(args).pid try: time.sleep(2) + import shutil + shutil.rmtree(self.wc_path) commands.clone(ui.ui(), 'svn://%s:%d/' % (self.host, self.port), self.wc_path, noupdate=True)
--- a/tests/test_rebuildmeta.py +++ b/tests/test_rebuildmeta.py @@ -5,8 +5,8 @@ import unittest from mercurial import hg from mercurial import ui -import svncommands -import hg_delta_editor +from hgsubversion import svncommands +from hgsubversion import hg_delta_editor import test_util
--- a/tests/test_tags.py +++ b/tests/test_tags.py @@ -6,7 +6,7 @@ from mercurial import ui import test_util -import svnrepo +from hgsubversion import svnrepo class TestTags(test_util.TestBase): def _load_fixture_and_fetch(self, fixture_name, stupid=False):
--- a/tests/test_urls.py +++ b/tests/test_urls.py @@ -1,6 +1,6 @@ import test_util import unittest -from svnwrap.svn_swig_wrapper import parse_url +from hgsubversion.svnwrap.svn_swig_wrapper import parse_url class TestSubversionUrls(test_util.TestBase): def test_standard_url(self):
--- a/tests/test_util.py +++ b/tests/test_util.py @@ -14,7 +14,7 @@ from mercurial import hg from mercurial import node from mercurial import ui -import util +from hgsubversion import util # Fixtures that need to be pulled at a subdirectory of the repo path subdir = {'truncatedhistory.svndump': '/project2', @@ -50,7 +50,7 @@ def load_fixture_and_fetch(fixture_name, load_svndump_fixture(repo_path, fixture_name) if subdir: repo_path += '/' + subdir - + _ui = ui.ui() _ui.setconfig('hgsubversion', 'stupid', str(stupid)) commands.clone(_ui, fileurl(repo_path), wc_path, noupdate=noupdate)
--- a/tests/test_utility_commands.py +++ b/tests/test_utility_commands.py @@ -8,10 +8,10 @@ from mercurial import revlog from mercurial import context from mercurial import node -import util -import utility_commands +from hgsubversion import util +from hgsubversion import utility_commands import test_util -import wrappers +from hgsubversion import wrappers expected_info_output = '''URL: %(repourl)s/%(branch)s Repository Root: %(repourl)s @@ -174,7 +174,7 @@ class UtilityTests(test_util.TestBase): def test_genignore(self): """ Test generation of .hgignore file. """ - test_util.load_fixture_and_fetch('ignores.svndump', self.repo_path, + test_util.load_fixture_and_fetch('ignores.svndump', self.repo_path, self.wc_path, noupdate=False) u = ui.ui() u.pushbuffer()