summaryrefslogtreecommitdiff
path: root/morphlib/buildsystem_tests.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-03-30 17:01:56 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-03-30 17:01:56 +0100
commit5f73977dc108ff119e63c68d225bec8c9b4378b0 (patch)
treee7648ec19415d60c6cc5992518b771c79250811e /morphlib/buildsystem_tests.py
parentdc589edd6f3faa94c6cbaf66c2caadff51cfbe5a (diff)
downloadmorph-5f73977dc108ff119e63c68d225bec8c9b4378b0.tar.gz
Make build system autodetection use an file existence function passed in
Diffstat (limited to 'morphlib/buildsystem_tests.py')
-rw-r--r--morphlib/buildsystem_tests.py28
1 files changed, 20 insertions, 8 deletions
diff --git a/morphlib/buildsystem_tests.py b/morphlib/buildsystem_tests.py
index 2d688922..8c790219 100644
--- a/morphlib/buildsystem_tests.py
+++ b/morphlib/buildsystem_tests.py
@@ -67,13 +67,16 @@ class ManualBuildSystemTests(unittest.TestCase):
def tearDown(self):
shutil.rmtree(self.tempdir)
+ def exists(self, filename):
+ return os.path.exists(os.path.join(self.tempdir, filename))
+
def test_does_not_autodetect_empty(self):
create_manual_project(self.tempdir)
- self.assertFalse(self.bs.used_by_project(self.tempdir))
+ self.assertFalse(self.bs.used_by_project(self.exists))
def test_does_not_autodetect_autotools(self):
create_autotools_project(self.tempdir)
- self.assertFalse(self.bs.used_by_project(self.tempdir))
+ self.assertFalse(self.bs.used_by_project(self.exists))
class DummyBuildSystemTests(unittest.TestCase):
@@ -85,13 +88,16 @@ class DummyBuildSystemTests(unittest.TestCase):
def tearDown(self):
shutil.rmtree(self.tempdir)
+ def exists(self, filename):
+ return os.path.exists(os.path.join(self.tempdir, filename))
+
def test_does_not_autodetect_empty(self):
create_manual_project(self.tempdir)
- self.assertFalse(self.bs.used_by_project(self.tempdir))
+ self.assertFalse(self.bs.used_by_project(self.exists))
def test_does_not_autodetect_autotools(self):
create_autotools_project(self.tempdir)
- self.assertFalse(self.bs.used_by_project(self.tempdir))
+ self.assertFalse(self.bs.used_by_project(self.exists))
class AutotoolsBuildSystemTests(unittest.TestCase):
@@ -103,13 +109,16 @@ class AutotoolsBuildSystemTests(unittest.TestCase):
def tearDown(self):
shutil.rmtree(self.tempdir)
+ def exists(self, filename):
+ return os.path.exists(os.path.join(self.tempdir, filename))
+
def test_does_not_autodetect_empty(self):
create_manual_project(self.tempdir)
- self.assertFalse(self.bs.used_by_project(self.tempdir))
+ self.assertFalse(self.bs.used_by_project(self.exists))
def test_autodetects_autotools(self):
create_autotools_project(self.tempdir)
- self.assertFalse(self.bs.used_by_project(self.tempdir))
+ self.assertFalse(self.bs.used_by_project(self.exists))
class DetectBuildSystemTests(unittest.TestCase):
@@ -120,15 +129,18 @@ class DetectBuildSystemTests(unittest.TestCase):
def tearDown(self):
shutil.rmtree(self.tempdir)
+
+ def exists(self, filename):
+ return os.path.exists(os.path.join(self.tempdir, filename))
def test_does_not_autodetect_manual(self):
create_manual_project(self.tempdir)
- bs = morphlib.buildsystem.detect_build_system(self.tempdir)
+ bs = morphlib.buildsystem.detect_build_system(self.exists)
self.assertEqual(bs, None)
def test_autodetects_autotools(self):
create_autotools_project(self.tempdir)
- bs = morphlib.buildsystem.detect_build_system(self.tempdir)
+ bs = morphlib.buildsystem.detect_build_system(self.exists)
self.assertEqual(type(bs), morphlib.buildsystem.AutotoolsBuildSystem)