aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStevan Radakovic <stevan.radakovic@linaro.org>2012-05-14 12:39:08 +0200
committerStevan Radakovic <stevan.radakovic@linaro.org>2012-05-14 12:39:08 +0200
commit970cd2da5874d6504ea1b98599f4d76edf41571b (patch)
treec8544eafd8393722177a1d5528587eb6b0d121c8
parent8197ed75e9828bad9926e83854536d1020e73dbc (diff)
Small updates from danilos code review.
-rw-r--r--README2
-rw-r--r--testing/test_php_unit.py21
2 files changed, 13 insertions, 10 deletions
diff --git a/README b/README
index 9a90695..93cd867 100644
--- a/README
+++ b/README
@@ -103,5 +103,5 @@ Recent (as of 2012-05-08) Ubuntu/Debian releases have a broken phpunit package a
$ sudo pear config-set auto_discover 1
$ sudo pear install pear.phpunit.de/PHPUnit
-Then to run the test from the 'testing' directory:
+PHPUnit tests execution is already included in the python integration tests, but if you wish to run unit tests separately, do the following:
$ phpunit testing/LicenseHelperTest
diff --git a/testing/test_php_unit.py b/testing/test_php_unit.py
index 15da999..f226f33 100644
--- a/testing/test_php_unit.py
+++ b/testing/test_php_unit.py
@@ -1,25 +1,25 @@
-#!/usr/bin/env python
-
import os
+import tempfile
import subprocess
-import xml.etree.ElementTree as etree
+import xml.etree.ElementTree
from testtools import TestCase
from testtools.matchers import Equals
+from testtools.matchers import AllMatch
class PhpUnitTest(TestCase):
'''Tests for executing the PHP Unit tests'''
def setUp(self):
super(PhpUnitTest, self).setUp()
- self.xml_path = "testing/php_unit_test_result.xml"
+ self.xml_path = tempfile.mkstemp()[1]
if subprocess.Popen(['phpunit', '--log-junit',
self.xml_path, 'testing/LicenseHelperTest'],
stdout=open('/dev/null', 'w'),
stderr=subprocess.STDOUT).wait():
raise CommandNotFoundException("phpunit command not found. Please "
"install phpunit package and rerun tests.")
- self.xml_data = etree.parse(self.xml_path)
+ self.xml_data = xml.etree.ElementTree.parse(self.xml_path)
def tearDown(self):
super(PhpUnitTest, self).tearDown()
@@ -27,7 +27,10 @@ class PhpUnitTest(TestCase):
os.unlink(self.xml_path)
def test_run_php_unit_tests(self):
- self.assertThat(self.xml_data.getroot()[0].attrib['failures'],
- Equals("0"))
- self.assertThat(self.xml_data.getroot()[0].attrib['errors'],
- Equals("0"))
+ self.assertThat(
+ [
+ self.xml_data.getroot()[0].attrib['failures'],
+ self.xml_data.getroot()[0].attrib['errors']
+ ],
+ AllMatch(Equals("0"))
+ )