Mercurial > hgsubversion
changeset 644:95abc4cfc78f
tests: improve import logic
We already had some logic some logic to make us import the local
modules, but it failed under certain circumstances. I suspect that it
had to do with absolute vs. relative paths. Regardless of what the
root cause was, this fixes it.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Wed, 14 Jul 2010 15:39:21 +0200 |
parents | d2ef7220a079 |
children | 3cb5042531fb |
files | tests/__init__.py tests/run.py tests/test_diff.py tests/test_util.py |
diffstat | 4 files changed, 6 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
deleted file mode 100644 --- a/tests/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -import imp, os, sys - -sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
--- a/tests/run.py +++ b/tests/run.py @@ -4,7 +4,6 @@ import sys import unittest def tests(): - import test_util import test_binaryfiles import test_diff import test_externals @@ -62,19 +61,21 @@ if __name__ == '__main__': else: testargs = {'descriptions': 2} - # make sure our copy of hgsubversion gets imported sys.path.append(os.path.dirname(os.path.dirname(__file__))) if options.demandimport: from mercurial import demandimport demandimport.enable() + # make sure our copy of hgsubversion gets imported by loading test_util + import test_util + test_util.TestBase + # silence output when running outside nose import tempfile sys.stdout = tempfile.TemporaryFile() all = tests() - del all['test_util'] args = [i.split('.py')[0].replace('-', '_') for i in args]