Merge lp://staging/~stevanr/linaro-license-protection/autorun-php-unittests into lp://staging/~linaro-automation/linaro-license-protection/trunk
Proposed by
Stevan Radaković
Status: | Merged |
---|---|
Approved by: | Данило Шеган |
Approved revision: | 73 |
Merged at revision: | 73 |
Proposed branch: | lp://staging/~stevanr/linaro-license-protection/autorun-php-unittests |
Merge into: | lp://staging/~linaro-automation/linaro-license-protection/trunk |
Diff against target: |
77 lines (+40/-4) 4 files modified
README (+2/-3) testing/LicenseHelperTest.php (+1/-1) testing/__init__.py (+1/-0) testing/test_php_unit.py (+36/-0) |
To merge this branch: | bzr merge lp://staging/~stevanr/linaro-license-protection/autorun-php-unittests |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Данило Шеган (community) | Approve | ||
Review via email: mp+105498@code.staging.launchpad.net |
Description of the change
Add new test module with a single test which runs the PHP unit tests and check for failures or errors.
It uses phpunit 'write results to XML' feature, then parses the XML file for results.
To post a comment you must log in.
У пет, 11. 05 2012. у 15:51 +0000, Stevan Radaković пише: /code.launchpad .net/~stevanr/ linaro- license- protection/ autorun- php-unittests/ +merge/ 105498 de/PHPUnit LicenseHelperTe st
> Stevan Radaković has proposed merging lp:~stevanr/linaro-license-protection/autorun-php-unittests into lp:linaro-license-protection.
>
> Requested reviews:
> Данило Шеган (danilo): code
>
> For more details, see:
> https:/
>
> Add new test module with a single test which runs the PHP unit tests and check for failures or errors.
> It uses phpunit 'write results to XML' feature, then parses the XML file for results.
> разлике међу датотекама прилог (review-diff.txt)
> === modified file 'README'
> --- README 2012-05-11 12:20:01 +0000
> +++ README 2012-05-11 15:50:28 +0000
> @@ -104,5 +104,4 @@
> $ sudo pear install pear.phpunit.
>
> Then to run the test from the 'testing' directory:
> - $ cd testing/
> - $ phpunit LicenseHelperTest
> + $ phpunit testing/
Since we are going to be automatically running these tests using 'testr
run', perhaps it would be good to change the narrative to say something
like: To run only the PHP tests using phpunit directly, do the
following. Though, we might as well remove the entire paragraph, but
I'd rather not until we improve the Python integration to output the
actual failures properly.
> === added file 'testing/ test_php_ unit.py' test_php_ unit.py 1970-01-01 00:00:00 +0000 test_php_ unit.py 2012-05-11 15:50:28 +0000
> --- testing/
> +++ testing/
> @@ -0,0 +1,33 @@
> +#!/usr/bin/env python
I don't think you need this line.
> + ElementTree as etree
> +import os
> +import subprocess
> +import xml.etree.
It's not customary to rename imported classes/modules, unless they
conflict with a class in the file. FWIW, someone used to the
ElementTree might confuse the etree for the module instead of the class
and try to do etree.ElementTree inside the code: this adds nothing but
confusion, imho.
Not a big deal, but just thought I'd note my personal opinion.
> +from testtools import TestCase TestCase) : php_unit_ test_result. xml"
> +from testtools.matchers import Equals
> +
> +class PhpUnitTest(
> + '''Tests for executing the PHP Unit tests'''
> +
> + def setUp(self):
> + super(PhpUnitTest, self).setUp()
> + self.xml_path = "testing/
As you already know, I hate it when we are writing stuff to the code
directory. FWIW, one should be able to run tests on a read-only
location, though this project already fails that assumption. For
example, this is very useful for rolling out to production machines,
where IS can trust us not to introduce a bunch of temporary/transient
files in the production location.
> + if subprocess. Popen([ 'phpunit' , '--log-junit', LicenseHelperTe st'], open('/ dev/null' , 'w'), subprocess. STDOUT) .wait() : Exception( "phpunit command not found. Please " self.xml_ path)
> + self.xml_path, 'testing/
> + stdout=
> + stderr=
> + raise CommandNotFound
> + "install phpunit package and rerun tests.")
> + self.xml_data = etree.parse(
This is good, though I have a feeling it would have been cheaper to
parse JSON, which php...