aboutsummaryrefslogtreecommitdiff
path: root/tests/test_build_info.py
diff options
context:
space:
mode:
authorGeorgy Redkozubov <georgy.redkozubov@linaro.org>2012-05-23 11:11:02 +0400
committerGeorgy Redkozubov <georgy.redkozubov@linaro.org>2012-05-23 11:11:02 +0400
commite446473285ab309bc48469d418855a156bcc6489 (patch)
treeff9ac96b7ab0fc53c6ba0301b6b4c4d0097186a4 /tests/test_build_info.py
parent6effe13d2e956022d1fa797a1dcb422c68d97285 (diff)
Added PHP unit tests for BuildInfo class
Diffstat (limited to 'tests/test_build_info.py')
-rw-r--r--tests/test_build_info.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/test_build_info.py b/tests/test_build_info.py
new file mode 100644
index 0000000..759bd9f
--- /dev/null
+++ b/tests/test_build_info.py
@@ -0,0 +1,40 @@
+import os
+import tempfile
+import subprocess
+import xml.etree.ElementTree
+
+from testtools import TestCase
+from testtools.matchers import Equals
+from testtools.matchers import AllMatch
+
+from tests.test_click_through_license import CommandNotFoundException
+
+
+class BuildInfoTest(TestCase):
+ '''Tests for executing the BuildInfo PHP Unit tests'''
+
+ def setUp(self):
+ super(BuildInfoTest, self).setUp()
+
+ self.build_info_xml_path = tempfile.mkstemp()[1]
+ if subprocess.Popen(['phpunit', '--log-junit',
+ self.build_info_xml_path, 'tests/BuildInfoTest'],
+ stdout=open('/dev/null', 'w'),
+ stderr=subprocess.STDOUT).wait():
+ raise CommandNotFoundException("phpunit command not found. Please "
+ "install phpunit package and rerun tests.")
+ self.build_info_xml_data = xml.etree.ElementTree.parse(self.build_info_xml_path)
+
+ def tearDown(self):
+ super(BuildInfoTest, self).tearDown()
+ if os.path.exists(self.build_info_xml_path):
+ os.unlink(self.build_info_xml_path)
+
+ def test_run_buildinfo_tests(self):
+ self.assertThat(
+ [
+ self.build_info_xml_data.getroot()[0].attrib['failures'],
+ self.build_info_xml_data.getroot()[0].attrib['errors']
+ ],
+ AllMatch(Equals("0"))
+ )