[SCM] Samba Shared Repository - branch master updated
Jelmer Vernooij
jelmer at samba.org
Fri Jan 15 23:54:25 MST 2010
The branch, master has been updated
via 28577aa... Import testtools as well, required for subunit.
via b6b46b4... subunit: Import new version.
via 2e38cb2... Add README about subunit.
via 664b74d... Add script for updating the copy of subunit.
via 53d7c4c... Fix permissions - net subcommand modules don't need to be executable.
from 4e0090c... s4-torture: fixed DsReplicaGetInfo elements
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 28577aae928847e64a0274b5922e26e1f15d9916
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Fri Jan 8 02:09:20 2010 +0100
Import testtools as well, required for subunit.
commit b6b46b4978dcaffa0cd9803c43b8a5f1c19e227e
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Thu Dec 31 18:48:41 2009 +0100
subunit: Import new version.
commit 2e38cb2cbb7520b2630ed85c3df2eb678c737fda
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Thu Dec 31 18:32:17 2009 +0100
Add README about subunit.
commit 664b74d3669841059224fdf2fc94b53a36613888
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Thu Dec 31 18:31:23 2009 +0100
Add script for updating the copy of subunit.
commit 53d7c4c7a27ec351638b35458919c8a267b794db
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Thu Dec 31 18:17:23 2009 +0100
Fix permissions - net subcommand modules don't need to be executable.
-----------------------------------------------------------------------
Summary of changes:
lib/subunit/README | 7 +
lib/subunit/filters/tap2subunit | 26 +
lib/subunit/python/iso8601/LICENSE | 20 +
lib/subunit/python/iso8601/README | 26 +
lib/subunit/python/iso8601/README.subunit | 5 +
lib/subunit/python/iso8601/setup.py | 58 +
lib/subunit/python/iso8601/test_iso8601.py | 111 ++
lib/subunit/python/subunit/__init__.py | 1107 ++++++++++++++++----
lib/subunit/python/subunit/chunked.py | 164 +++
lib/subunit/python/subunit/details.py | 109 ++
lib/subunit/python/subunit/iso8601.py | 123 +++
lib/subunit/python/subunit/progress_model.py | 106 ++
lib/subunit/python/subunit/run.py | 46 +
lib/subunit/python/subunit/test_results.py | 334 ++++++
lib/subunit/python/subunit/tests/__init__.py | 44 +-
lib/subunit/python/subunit/tests/sample-script.py | 7 +
lib/subunit/python/subunit/tests/test_chunked.py | 127 +++
lib/subunit/python/subunit/tests/test_details.py | 110 ++
.../python/subunit/tests/test_progress_model.py | 118 +++
.../python/subunit/tests/test_subunit_filter.py | 136 +++
.../python/subunit/tests/test_subunit_stats.py | 83 ++
.../python/subunit/tests/test_subunit_tags.py | 68 ++
.../python/subunit/tests/test_tap2subunit.py | 432 ++++++++
.../python/subunit/tests/test_test_protocol.py | 967 +++++++++++++-----
.../python/subunit/tests/test_test_results.py | 199 ++++
lib/subunit/python/testtools/__init__.py | 58 +
lib/subunit/python/testtools/content.py | 91 ++
lib/subunit/python/testtools/content_type.py | 30 +
lib/subunit/python/testtools/matchers.py | 169 +++
lib/subunit/python/testtools/run.py | 39 +
lib/subunit/python/testtools/runtest.py | 142 +++
lib/subunit/python/testtools/testcase.py | 444 ++++++++
.../python/testtools/testresult/__init__.py | 19 +
lib/subunit/python/testtools/testresult/doubles.py | 95 ++
lib/subunit/python/testtools/testresult/real.py | 540 ++++++++++
lib/subunit/python/testtools/tests/__init__.py | 28 +
lib/subunit/python/testtools/tests/helpers.py | 67 ++
lib/subunit/python/testtools/tests/test_content.py | 72 ++
.../python/testtools/tests/test_content_type.py | 34 +
.../python/testtools/tests/test_matchers.py | 113 ++
lib/subunit/python/testtools/tests/test_runtest.py | 185 ++++
.../python/testtools/tests/test_testresult.py | 807 ++++++++++++++
.../python/testtools/tests/test_testsuite.py | 56 +
.../python/testtools/tests/test_testtools.py | 743 +++++++++++++
lib/subunit/python/testtools/testsuite.py | 74 ++
lib/subunit/python/testtools/utils.py | 39 +
lib/subunit/tap2subunit | 35 -
lib/subunit/update.sh | 16 +
source4/lib/ldb/tests/python/acl.py | 3 +-
source4/lib/ldb/tests/python/ldap.py | 3 +-
source4/lib/ldb/tests/python/ldap_schema.py | 3 +-
source4/lib/ldb/tests/python/sec_descriptor.py | 3 +-
source4/scripting/bin/subunitrun | 3 +-
source4/scripting/python/config.mk | 2 +-
source4/selftest/tests.sh | 2 +-
55 files changed, 7934 insertions(+), 514 deletions(-)
create mode 100644 lib/subunit/README
create mode 100755 lib/subunit/filters/tap2subunit
create mode 100644 lib/subunit/python/iso8601/LICENSE
create mode 100644 lib/subunit/python/iso8601/README
create mode 100644 lib/subunit/python/iso8601/README.subunit
create mode 100644 lib/subunit/python/iso8601/setup.py
create mode 100644 lib/subunit/python/iso8601/test_iso8601.py
create mode 100644 lib/subunit/python/subunit/chunked.py
create mode 100644 lib/subunit/python/subunit/details.py
create mode 100644 lib/subunit/python/subunit/iso8601.py
create mode 100644 lib/subunit/python/subunit/progress_model.py
create mode 100755 lib/subunit/python/subunit/run.py
create mode 100644 lib/subunit/python/subunit/test_results.py
create mode 100644 lib/subunit/python/subunit/tests/test_chunked.py
create mode 100644 lib/subunit/python/subunit/tests/test_details.py
create mode 100644 lib/subunit/python/subunit/tests/test_progress_model.py
create mode 100644 lib/subunit/python/subunit/tests/test_subunit_filter.py
create mode 100644 lib/subunit/python/subunit/tests/test_subunit_stats.py
create mode 100644 lib/subunit/python/subunit/tests/test_subunit_tags.py
create mode 100644 lib/subunit/python/subunit/tests/test_tap2subunit.py
create mode 100644 lib/subunit/python/subunit/tests/test_test_results.py
create mode 100644 lib/subunit/python/testtools/__init__.py
create mode 100644 lib/subunit/python/testtools/content.py
create mode 100644 lib/subunit/python/testtools/content_type.py
create mode 100644 lib/subunit/python/testtools/matchers.py
create mode 100755 lib/subunit/python/testtools/run.py
create mode 100644 lib/subunit/python/testtools/runtest.py
create mode 100644 lib/subunit/python/testtools/testcase.py
create mode 100644 lib/subunit/python/testtools/testresult/__init__.py
create mode 100644 lib/subunit/python/testtools/testresult/doubles.py
create mode 100644 lib/subunit/python/testtools/testresult/real.py
create mode 100644 lib/subunit/python/testtools/tests/__init__.py
create mode 100644 lib/subunit/python/testtools/tests/helpers.py
create mode 100644 lib/subunit/python/testtools/tests/test_content.py
create mode 100644 lib/subunit/python/testtools/tests/test_content_type.py
create mode 100644 lib/subunit/python/testtools/tests/test_matchers.py
create mode 100644 lib/subunit/python/testtools/tests/test_runtest.py
create mode 100644 lib/subunit/python/testtools/tests/test_testresult.py
create mode 100644 lib/subunit/python/testtools/tests/test_testsuite.py
create mode 100644 lib/subunit/python/testtools/tests/test_testtools.py
create mode 100644 lib/subunit/python/testtools/testsuite.py
create mode 100644 lib/subunit/python/testtools/utils.py
delete mode 100755 lib/subunit/tap2subunit
create mode 100755 lib/subunit/update.sh
mode change 100755 => 100644 source4/scripting/python/samba/netcmd/enableaccount.py
mode change 100755 => 100644 source4/scripting/python/samba/netcmd/newuser.py
Changeset truncated at 500 lines:
diff --git a/lib/subunit/README b/lib/subunit/README
new file mode 100644
index 0000000..c657992
--- /dev/null
+++ b/lib/subunit/README
@@ -0,0 +1,7 @@
+This directory contains some helper code for the Subunit protocol. It is
+a partial import of the code from the upstream subunit project, which can
+be found at https://launchpad.net/subunit.
+
+To update the snapshot, run update.sh in this directory. When making changes
+here, please also submit them upstream - otherwise they'll be gone by the
+next time we import subunit.
diff --git a/lib/subunit/filters/tap2subunit b/lib/subunit/filters/tap2subunit
new file mode 100755
index 0000000..c571972
--- /dev/null
+++ b/lib/subunit/filters/tap2subunit
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# subunit: extensions to python unittest to get test results from subprocesses.
+# Copyright (C) 2009 Robert Collins <robertc at robertcollins.net>
+#
+# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
+# license at the users choice. A copy of both licenses are available in the
+# project source as Apache-2.0 and BSD. You may not use this file except in
+# compliance with one of these two licences.
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# license you chose for the specific language governing permissions and
+# limitations under that license.
+#
+
+"""A filter that reads a TAP stream and outputs a subunit stream.
+
+More information on TAP is available at
+http://testanything.org/wiki/index.php/Main_Page.
+"""
+
+import sys
+
+from subunit import TAP2SubUnit
+sys.exit(TAP2SubUnit(sys.stdin, sys.stdout))
diff --git a/lib/subunit/python/iso8601/LICENSE b/lib/subunit/python/iso8601/LICENSE
new file mode 100644
index 0000000..5ca93da
--- /dev/null
+++ b/lib/subunit/python/iso8601/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2007 Michael Twomey
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/lib/subunit/python/iso8601/README b/lib/subunit/python/iso8601/README
new file mode 100644
index 0000000..5ec9d45
--- /dev/null
+++ b/lib/subunit/python/iso8601/README
@@ -0,0 +1,26 @@
+A simple package to deal with ISO 8601 date time formats.
+
+ISO 8601 defines a neutral, unambiguous date string format, which also
+has the property of sorting naturally.
+
+e.g. YYYY-MM-DDTHH:MM:SSZ or 2007-01-25T12:00:00Z
+
+Currently this covers only the most common date formats encountered, not
+all of ISO 8601 is handled.
+
+Currently the following formats are handled:
+
+* 2006-01-01T00:00:00Z
+* 2006-01-01T00:00:00[+-]00:00
+
+I'll add more as I encounter them in my day to day life. Patches with
+new formats and tests will be gratefully accepted of course :)
+
+References:
+
+* http://www.cl.cam.ac.uk/~mgk25/iso-time.html - simple overview
+
+* http://hydracen.com/dx/iso8601.htm - more detailed enumeration of
+ valid formats.
+
+See the LICENSE file for the license this package is released under.
diff --git a/lib/subunit/python/iso8601/README.subunit b/lib/subunit/python/iso8601/README.subunit
new file mode 100644
index 0000000..d1ed8a1
--- /dev/null
+++ b/lib/subunit/python/iso8601/README.subunit
@@ -0,0 +1,5 @@
+This is a [slightly rearranged] import of http://pypi.python.org/pypi/iso8601/
+version 0.1.4. The OS X hidden files have been stripped, and the package
+turned into a single module, to simplify installation. The remainder of the
+source distribution is included in the subunit source tree at python/iso8601
+for reference.
diff --git a/lib/subunit/python/iso8601/setup.py b/lib/subunit/python/iso8601/setup.py
new file mode 100644
index 0000000..cdb61ec
--- /dev/null
+++ b/lib/subunit/python/iso8601/setup.py
@@ -0,0 +1,58 @@
+try:
+ from setuptools import setup
+except ImportError:
+ from distutils import setup
+
+long_description="""Simple module to parse ISO 8601 dates
+
+This module parses the most common forms of ISO 8601 date strings (e.g.
+2007-01-14T20:34:22+00:00) into datetime objects.
+
+>>> import iso8601
+>>> iso8601.parse_date("2007-01-25T12:00:00Z")
+datetime.datetime(2007, 1, 25, 12, 0, tzinfo=<iso8601.iso8601.Utc ...>)
+>>>
+
+Changes
+=======
+
+0.1.4
+-----
+
+* The default_timezone argument wasn't being passed through correctly,
+ UTC was being used in every case. Fixes issue 10.
+
+0.1.3
+-----
+
+* Fixed the microsecond handling, the generated microsecond values were
+ way too small. Fixes issue 9.
+
+0.1.2
+-----
+
+* Adding ParseError to __all__ in iso8601 module, allows people to import it.
+ Addresses issue 7.
+* Be a little more flexible when dealing with dates without leading zeroes.
+ This violates the spec a little, but handles more dates as seen in the
+ field. Addresses issue 6.
+* Allow date/time separators other than T.
+
+0.1.1
+-----
+
+* When parsing dates without a timezone the specified default is used. If no
+ default is specified then UTC is used. Addresses issue 4.
+"""
+
+setup(
+ name="iso8601",
+ version="0.1.4",
+ description=long_description.split("\n")[0],
+ long_description=long_description,
+ author="Michael Twomey",
+ author_email="micktwomey+iso8601 at gmail.com",
+ url="http://code.google.com/p/pyiso8601/",
+ packages=["iso8601"],
+ license="MIT",
+)
diff --git a/lib/subunit/python/iso8601/test_iso8601.py b/lib/subunit/python/iso8601/test_iso8601.py
new file mode 100644
index 0000000..ff9e273
--- /dev/null
+++ b/lib/subunit/python/iso8601/test_iso8601.py
@@ -0,0 +1,111 @@
+import iso8601
+
+def test_iso8601_regex():
+ assert iso8601.ISO8601_REGEX.match("2006-10-11T00:14:33Z")
+
+def test_timezone_regex():
+ assert iso8601.TIMEZONE_REGEX.match("+01:00")
+ assert iso8601.TIMEZONE_REGEX.match("+00:00")
+ assert iso8601.TIMEZONE_REGEX.match("+01:20")
+ assert iso8601.TIMEZONE_REGEX.match("-01:00")
+
+def test_parse_date():
+ d = iso8601.parse_date("2006-10-20T15:34:56Z")
+ assert d.year == 2006
+ assert d.month == 10
+ assert d.day == 20
+ assert d.hour == 15
+ assert d.minute == 34
+ assert d.second == 56
+ assert d.tzinfo == iso8601.UTC
+
+def test_parse_date_fraction():
+ d = iso8601.parse_date("2006-10-20T15:34:56.123Z")
+ assert d.year == 2006
+ assert d.month == 10
+ assert d.day == 20
+ assert d.hour == 15
+ assert d.minute == 34
+ assert d.second == 56
+ assert d.microsecond == 123000
+ assert d.tzinfo == iso8601.UTC
+
+def test_parse_date_fraction_2():
+ """From bug 6
+
+ """
+ d = iso8601.parse_date("2007-5-7T11:43:55.328Z'")
+ assert d.year == 2007
+ assert d.month == 5
+ assert d.day == 7
+ assert d.hour == 11
+ assert d.minute == 43
+ assert d.second == 55
+ assert d.microsecond == 328000
+ assert d.tzinfo == iso8601.UTC
+
+def test_parse_date_tz():
+ d = iso8601.parse_date("2006-10-20T15:34:56.123+02:30")
+ assert d.year == 2006
+ assert d.month == 10
+ assert d.day == 20
+ assert d.hour == 15
+ assert d.minute == 34
+ assert d.second == 56
+ assert d.microsecond == 123000
+ assert d.tzinfo.tzname(None) == "+02:30"
+ offset = d.tzinfo.utcoffset(None)
+ assert offset.days == 0
+ assert offset.seconds == 60 * 60 * 2.5
+
+def test_parse_invalid_date():
+ try:
+ iso8601.parse_date(None)
+ except iso8601.ParseError:
+ pass
+ else:
+ assert 1 == 2
+
+def test_parse_invalid_date2():
+ try:
+ iso8601.parse_date("23")
+ except iso8601.ParseError:
+ pass
+ else:
+ assert 1 == 2
+
+def test_parse_no_timezone():
+ """issue 4 - Handle datetime string without timezone
+
+ This tests what happens when you parse a date with no timezone. While not
+ strictly correct this is quite common. I'll assume UTC for the time zone
+ in this case.
+ """
+ d = iso8601.parse_date("2007-01-01T08:00:00")
+ assert d.year == 2007
+ assert d.month == 1
+ assert d.day == 1
+ assert d.hour == 8
+ assert d.minute == 0
+ assert d.second == 0
+ assert d.microsecond == 0
+ assert d.tzinfo == iso8601.UTC
+
+def test_parse_no_timezone_different_default():
+ tz = iso8601.FixedOffset(2, 0, "test offset")
+ d = iso8601.parse_date("2007-01-01T08:00:00", default_timezone=tz)
+ assert d.tzinfo == tz
+
+def test_space_separator():
+ """Handle a separator other than T
+
+ """
+ d = iso8601.parse_date("2007-06-23 06:40:34.00Z")
+ assert d.year == 2007
+ assert d.month == 6
+ assert d.day == 23
+ assert d.hour == 6
+ assert d.minute == 40
+ assert d.second == 34
+ assert d.microsecond == 0
+ assert d.tzinfo == iso8601.UTC
diff --git a/lib/subunit/python/subunit/__init__.py b/lib/subunit/python/subunit/__init__.py
index 406cd87..6e8df90 100644
--- a/lib/subunit/python/subunit/__init__.py
+++ b/lib/subunit/python/subunit/__init__.py
@@ -1,28 +1,151 @@
#
-# subunit: extensions to python unittest to get test results from subprocesses.
+# subunit: extensions to Python unittest to get test results from subprocesses.
# Copyright (C) 2005 Robert Collins <robertc at robertcollins.net>
-# Copyright (C) 2007 Jelmer Vernooij <jelmer at samba.org>
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
+# license at the users choice. A copy of both licenses are available in the
+# project source as Apache-2.0 and BSD. You may not use this file except in
+# compliance with one of these two licences.
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# license you chose for the specific language governing permissions and
+# limitations under that license.
#
+"""Subunit - a streaming test protocol
+
+Overview
+++++++++
+
+The ``subunit`` Python package provides a number of ``unittest`` extensions
+which can be used to cause tests to output Subunit, to parse Subunit streams
+into test activity, perform seamless test isolation within a regular test
+case and variously sort, filter and report on test runs.
+
+
+Key Classes
+-----------
+
+The ``subunit.TestProtocolClient`` class is a ``unittest.TestResult``
+extension which will translate a test run into a Subunit stream.
+
+The ``subunit.ProtocolTestCase`` class is an adapter between the Subunit wire
+protocol and the ``unittest.TestCase`` object protocol. It is used to translate
+a stream into a test run, which regular ``unittest.TestResult`` objects can
+process and report/inspect.
+
+Subunit has support for non-blocking usage too, for use with asyncore or
+Twisted. See the ``TestProtocolServer`` parser class for more details.
+
+Subunit includes extensions to the Python ``TestResult`` protocol. These are
+all done in a compatible manner: ``TestResult`` objects that do not implement
+the extension methods will not cause errors to be raised, instead the extension
+will either lose fidelity (for instance, folding expected failures to success
+in Python versions < 2.7 or 3.1), or discard the extended data (for extra
+details, tags, timestamping and progress markers).
+
+The test outcome methods ``addSuccess``, ``addError``, ``addExpectedFailure``,
+``addFailure``, ``addSkip`` take an optional keyword parameter ``details``
+which can be used instead of the usual python unittest parameter.
+When used the value of details should be a dict from ``string`` to
+``testtools.content.Content`` objects. This is a draft API being worked on with
+the Python Testing In Python mail list, with the goal of permitting a common
+way to provide additional data beyond a traceback, such as captured data from
+disk, logging messages etc. The reference for this API is in testtools (0.9.0
+and newer).
+
+The ``tags(new_tags, gone_tags)`` method is called (if present) to add or
+remove tags in the test run that is currently executing. If called when no
+test is in progress (that is, if called outside of the ``startTest``,
+``stopTest`` pair), the the tags apply to all sebsequent tests. If called
+when a test is in progress, then the tags only apply to that test.
+
+The ``time(a_datetime)`` method is called (if present) when a ``time:``
+directive is encountered in a Subunit stream. This is used to tell a TestResult
+about the time that events in the stream occured at, to allow reconstructing
+test timing from a stream.
+
+The ``progress(offset, whence)`` method controls progress data for a stream.
+The offset parameter is an int, and whence is one of subunit.PROGRESS_CUR,
+subunit.PROGRESS_SET, PROGRESS_PUSH, PROGRESS_POP. Push and pop operations
+ignore the offset parameter.
+
+
+Python test support
+-------------------
+
+``subunit.run`` is a convenience wrapper to run a Python test suite via
+the command line, reporting via Subunit::
+
+ $ python -m subunit.run mylib.tests.test_suite
+
+The ``IsolatedTestSuite`` class is a TestSuite that forks before running its
+tests, allowing isolation between the test runner and some tests.
+
+Similarly, ``IsolatedTestCase`` is a base class which can be subclassed to get
+tests that will fork() before that individual test is run.
+
+`ExecTestCase`` is a convenience wrapper for running an external
+program to get a Subunit stream and then report that back to an arbitrary
+result object::
+
+ class AggregateTests(subunit.ExecTestCase):
+
+ def test_script_one(self):
+ './bin/script_one'
+
+ def test_script_two(self):
+ './bin/script_two'
+
+ # Normally your normal test loading would take of this automatically,
+ # It is only spelt out in detail here for clarity.
+ suite = unittest.TestSuite([AggregateTests("test_script_one"),
+ AggregateTests("test_script_two")])
+ # Create any TestResult class you like.
+ result = unittest._TextTestResult(sys.stdout)
+ # And run your suite as normal, Subunit will exec each external script as
+ # needed and report to your result object.
+ suite.run(result)
+
+Utility modules
+---------------
+
+* subunit.chunked contains HTTP chunked encoding/decoding logic.
+* subunit.test_results contains TestResult helper classes.
+"""
+
+import datetime
import os
+import re
from StringIO import StringIO
+import subprocess
import sys
import unittest
+import iso8601
+from testtools import content, content_type, ExtendedToOriginalDecorator
+try:
+ from testtools.testresult.real import _StringException
+ RemoteException = _StringException
+ _remote_exception_str = '_StringException' # For testing.
+except ImportError:
+ raise ImportError ("testtools.testresult.real does not contain "
+ "_StringException, check your version.")
+
+
+from testtools.testresult.real import _StringException
+
+import chunked, details, test_results
+
+
+PROGRESS_SET = 0
+PROGRESS_CUR = 1
+PROGRESS_PUSH = 2
+PROGRESS_POP = 3
+
+
def test_suite():
import subunit.tests
return subunit.tests.test_suite()
@@ -42,211 +165,558 @@ def join_dir(base_path, path):
return os.path.join(os.path.dirname(os.path.abspath(base_path)), path)
-class TestProtocolServer(object):
- """A class for receiving results from a TestProtocol client."""
-
- OUTSIDE_TEST = 0
- TEST_STARTED = 1
- READING_FAILURE = 2
- READING_ERROR = 3
-
- def __init__(self, client, stream=sys.stdout):
- """Create a TestProtocol server instance.
-
- client should be an object that provides
- - startTest
- - addSuccess
- - addFailure
- - addError
- - stopTest
- methods, i.e. a TestResult.
- """
- self.state = TestProtocolServer.OUTSIDE_TEST
- self.client = client
- self._stream = stream
-
- def _addError(self, offset, line):
- if (self.state == TestProtocolServer.TEST_STARTED and
- self.current_test_description == line[offset:-1]):
- self.state = TestProtocolServer.OUTSIDE_TEST
- self.current_test_description = None
- self.client.addError(self._current_test, RemoteError(""))
- self.client.stopTest(self._current_test)
--
Samba Shared Repository
More information about the samba-cvs
mailing list