Skip to content

Commit

Permalink
add some first-run info for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
termie committed May 8, 2011
1 parent b9c5c18 commit b14d6f5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
10 changes: 10 additions & 0 deletions run_tests.sh
@@ -1,2 +1,12 @@
#!/bin/sh #!/bin/sh
if [ ! -f "run_tests.log" ];
then
echo "The first time you run this will most likely take quite a while"
echo "as it will be checking out quite a lot of different vendor"
echo "packages to test against."
echo ""
echo "Running some preliminary setup in 5 seconds."
sleep 5
python run_tests.py tests.test_basic:SetupVendorOnly.setup_vendor
fi
python run_tests.py $@ 2> run_tests.log python run_tests.py $@ 2> run_tests.log
30 changes: 23 additions & 7 deletions tests/test_basic.py
Expand Up @@ -95,17 +95,14 @@ def rmdir(path):
pass pass




class GitBzrTest(unittest.TestCase): class SetupVendorOnly(object):
BZR = BZRPATH % '2.3.1' BZR = BZRPATH % '2.3.1'
BZRFASTIMPORT = BZRFASTIMPORT_STABLE BZRFASTIMPORT = BZRFASTIMPORT_STABLE


def setUp(self): def setup_vendor(self):
logging.getLogger().setLevel(logging.INFO)
self._ensure_checkouts() self._ensure_checkouts()
self._symlink_plugin() self._symlink_plugin()
self._setup_bzr_branches()

def tearDown(self):
pass


def _symlink_plugin(self): def _symlink_plugin(self):
try: try:
Expand Down Expand Up @@ -133,6 +130,7 @@ def _ensure_checkouts(self):
tarball = 'bzr-%s.tar.gz' tarball = 'bzr-%s.tar.gz'
for v in VERSIONS: for v in VERSIONS:
if not os.path.exists(BZRPATH % v[1]): if not os.path.exists(BZRPATH % v[1]):
logging.info('Downloading %s', download_url % (v[0], v[1], v[1]))
cd(VENDOR) cd(VENDOR)
check_output(['curl', '-O', '-L', check_output(['curl', '-O', '-L',
download_url % (v[0], v[1], v[1]) download_url % (v[0], v[1], v[1])
Expand All @@ -144,25 +142,30 @@ def _ensure_checkouts(self):


bzr_head = BZRPATH % 'head' bzr_head = BZRPATH % 'head'
if not os.path.exists(bzr_head): if not os.path.exists(bzr_head):
logging.info('Getting HEAD of bzr')
cd(VENDOR) cd(VENDOR)
bzr('branch', 'lp:bzr', BZRPATH % 'head') bzr('branch', 'lp:bzr', BZRPATH % 'head')


if not os.path.exists(PYFASTIMPORT): if not os.path.exists(PYFASTIMPORT):
logging.info('Getting a HEAD of python-fastimport')
cd(VENDOR) cd(VENDOR)
bzr('branch', 'lp:python-fastimport') bzr('branch', 'lp:python-fastimport')


if not os.path.exists(PLUGINDIR): if not os.path.exists(PLUGINDIR):
os.mkdir(PLUGINDIR) os.mkdir(PLUGINDIR)


if not os.path.exists(BZRFASTIMPORT_STABLE): if not os.path.exists(BZRFASTIMPORT_STABLE):
logging.info('Getting revision 307 of bzr-fastimport')
cd(VENDOR) cd(VENDOR)
bzr('branch', 'lp:bzr-fastimport', '-r', '307', BZRFASTIMPORT_STABLE) bzr('branch', 'lp:bzr-fastimport', '-r', '307', BZRFASTIMPORT_STABLE)


if not os.path.exists(BZRFASTIMPORT_HEAD): if not os.path.exists(BZRFASTIMPORT_HEAD):
logging.info('Getting HEAD of bzr-fastimport')
cd(VENDOR) cd(VENDOR)
bzr('branch', 'lp:bzr-fastimport', BZRFASTIMPORT_HEAD) bzr('branch', 'lp:bzr-fastimport', BZRFASTIMPORT_HEAD)


if not os.path.exists(BZRFASTIMPORT_STABLE_TARBALL): if not os.path.exists(BZRFASTIMPORT_STABLE_TARBALL):
logging.info('Downloading bzr-fastimport version 0.10')
cd(VENDOR) cd(VENDOR)
check_output(['curl', '-O', '-L', check_output(['curl', '-O', '-L',
'http://launchpad.net/bzr-fastimport/trunk/' 'http://launchpad.net/bzr-fastimport/trunk/'
Expand All @@ -179,6 +182,20 @@ def _ensure_checkouts(self):
os.environ['BZR_PLUGIN_PATH'] = PLUGINDIR os.environ['BZR_PLUGIN_PATH'] = PLUGINDIR
os.environ['BZR_PDB'] = '1' os.environ['BZR_PDB'] = '1'



class GitBzrTest(SetupVendorOnly, unittest.TestCase):
BZR = BZRPATH % '2.3.1'
BZRFASTIMPORT = BZRFASTIMPORT_STABLE

def setUp(self):
#SetupVendorOnly.setUp(self)
self._ensure_checkouts()
self._symlink_plugin()
self._setup_bzr_branches()

def tearDown(self):
pass

def _setup_bzr_branches(self): def _setup_bzr_branches(self):
memo = '%s_%s_%s' % (TESTDIR, self.__class__.__name__, TIMESTAMP) memo = '%s_%s_%s' % (TESTDIR, self.__class__.__name__, TIMESTAMP)
if os.path.exists(memo): if os.path.exists(memo):
Expand Down Expand Up @@ -214,7 +231,6 @@ def _setup_bzr_branches(self):
shutil.rmtree(path) shutil.rmtree(path)
shutil.copytree(TESTDIR, memo) shutil.copytree(TESTDIR, memo)



def test_all(self): def test_all(self):
"""Test most of the functionality. """Test most of the functionality.
Expand Down

0 comments on commit b14d6f5

Please sign in to comment.