[SCM] Samba Shared Repository - branch master updated

Jelmer Vernooij jelmer at samba.org
Fri Nov 21 20:45:03 MST 2014


The branch, master has been updated
       via  2c67d55 Include mimeparse, which is used by subunit/testtools.
       via  d857e7b ldap: Use samba.tests.subunitrun.
       via  cfb5e9b deletetest: use samba.tests.subunitrun.
       via  6fb26c0 ldap_syntaxes: Use samba.tests.subunitrun.
       via  3961bd6 password lockout: Use samba.tests.subunitrun.
       via  eae1efc passwords: Use samba.tests.subunitrun.
       via  0c82bdd sec_descriptor: Use samba.tests.subunitrun.
       via  fc0b8aa token_group: Use samba.tests.subunitrun.
       via  3305975 sites: Use samba.tests.subunitrun.
       via  d6545fe speedtest: Use samba.tests.subunitrun.
       via  8d933a8 credentials test: Use samba.tests.subunitrun.
       via  21280da sec_descriptor test: Simplify, use samba.tests.subunitrun module.
       via  ee281c6 Move option handling into samba.tests.subunitrun.
       via  24035a6 Move option parsing to samba.tests.subunitrun.
       via  ed4c07b subunitrun: Use new samba.tests.subunitrun module.
       via  8d8d800 Add convenience class for old-style Samba subunit python tests.
       via  a92877f Add bundled copy of 'extras' python module used by newer versions of testtools/subunit.
       via  3949ed6 Clean up more whitespace.
      from  927290b vfs_streams_xattr: check stream type

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 2c67d55614668583dc6290c6db86d5229fb654ea
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Nov 1 07:09:00 2014 -0700

    Include mimeparse, which is used by subunit/testtools.
    
    Change-Id: I984c82acc0bc82a165e8ea17d8948c465c786905
    Signed-Off-By: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Jelmer Vernooij <jelmer at samba.org>
    Autobuild-Date(master): Sat Nov 22 04:44:11 CET 2014 on sn-devel-104

commit d857e7b1a7a2cc1f7f4f9f2ffd5a11f8c627ae39
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Nov 2 09:44:05 2014 -0800

    ldap: Use samba.tests.subunitrun.
    
    Change-Id: I872654afb31a5eda8c88aac716f9ce79816e5f05
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit cfb5e9bbf2bde885c50097ab0a2914c674e65860
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Nov 2 09:39:17 2014 -0800

    deletetest: use samba.tests.subunitrun.
    
    Change-Id: I13565c7c14ea186709ce1de9038ef840c5b766b8
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 6fb26c0e29d74c793f8714b057e0ed0e5ee0cc37
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Nov 2 09:32:58 2014 -0800

    ldap_syntaxes: Use samba.tests.subunitrun.
    
    Change-Id: Ib62b747876b4408fdc8ff44e9b4c63578e1a6408
    Signed-Off-By: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3961bd68cad510c3ac06270036b54b065d0c3566
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Nov 2 09:30:50 2014 -0800

    password lockout: Use samba.tests.subunitrun.
    
    Change-Id: I848099d22acd4a0ce7d589de48eb72e2d180ceae
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit eae1efca41f4714afedff74afe330aad970f44ab
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Nov 2 09:13:06 2014 -0800

    passwords: Use samba.tests.subunitrun.
    
    Change-Id: Ib806f63ef412fec264445eefd82146e5140b0bac
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 0c82bdda0fddab4aa6bdbbbe13b6f888ed1c2c67
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Nov 2 08:57:37 2014 -0800

    sec_descriptor: Use samba.tests.subunitrun.
    
    Change-Id: I5caba3e27ad21cc5381883a823e0ec5e2966a264
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit fc0b8aac9d5f1f77aa9a412fa5da2cc6b1a984ae
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Nov 2 08:35:06 2014 -0800

    token_group: Use samba.tests.subunitrun.
    
    Change-Id: Id7c247451532eded1f44ef9b1aa1808dd18098c6
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 330597507c796db55a48b084c7542f03ee4a93ee
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Nov 2 08:37:08 2014 -0800

    sites: Use samba.tests.subunitrun.
    
    Change-Id: Ic06e1a0f7174683b6b817a5412b8635145329c00
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit d6545fe27b35e63781f9f87fe9262bb933ffa9be
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Nov 2 08:32:24 2014 -0800

    speedtest: Use samba.tests.subunitrun.
    
    Change-Id: Id842c3f74aec24faeab68e975ff4d9e9a0dc337b
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 8d933a84c96859cbb782d5ac693f9badf2531947
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Nov 2 08:30:23 2014 -0800

    credentials test: Use samba.tests.subunitrun.
    
    Change-Id: I8970c66de9535cb8d48b17d88b2759b7d1e39cb8
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 21280da0d6a4e3c547de8f486fe6ae84eea3f135
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Nov 2 08:23:36 2014 -0800

    sec_descriptor test: Simplify, use samba.tests.subunitrun module.
    
    Change-Id: I4ffda49cf3e209eaa28fc83f6fd9ded47f0ad7ee
    Signed-Off-By: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ee281c61d01b5fb167571b8ace5e739758100db6
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Nov 1 21:17:39 2014 -0700

    Move option handling into samba.tests.subunitrun.
    
    Change-Id: I65a73b74854af636413f4f284147f3bcf28b6f82
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 24035a6b3ed5ffdb1e75ebd375c3f7c2129742ff
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Nov 1 21:08:49 2014 -0700

    Move option parsing to samba.tests.subunitrun.
    
    Change-Id: I2939c1b6ebb9739530efa9bc4667668cff7a7aeb
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit ed4c07b34b5571c021684e3df6bf5fc63cde69c5
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Nov 1 20:57:09 2014 -0700

    subunitrun: Use new samba.tests.subunitrun module.
    
    Change-Id: Ie32f16d72c80c831adfd9a8d32735fa348962123
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 8d8d800a0f8ea3e822ee4d3693058b24307ba4e2
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Nov 1 20:51:46 2014 -0700

    Add convenience class for old-style Samba subunit python tests.
    
    Change-Id: I84a97cc71cfa99c14e0c93ec19ff9eea6149bb5a
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit a92877f955baf0ed8420f77898bd4405bd319c67
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Oct 25 11:09:10 2014 -0700

    Add bundled copy of 'extras' python module used by newer versions of testtools/subunit.
    
    Change-Id: I5ad9222ccb4228a4b16d54a578276d4b9d4e6c4d
    Signed-Off-By: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 3949ed67fcb51a88972f89e9a1c9d674b16c8e9a
Author: Guy Harris <guy at alum.mit.edu>
Date:   Fri Nov 21 15:52:32 2014 +0000

    Clean up more whitespace.
    
    Reviewed-By: Jelmer Vernooij <jelmer at samba.org>
    Reviewed-By: Kamen Mazdrashki <kamenim at samba.org>
    Signed-Off-By: Jelmer Vernooij <jelmer at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 auth/credentials/tests/bind.py                     |  34 +-
 lib/extras/.gitignore                              |  35 ++
 lib/{testtools => extras}/.testr.conf              |   0
 lib/{ccan/time => extras}/LICENSE                  |  17 +-
 lib/extras/MANIFEST.in                             |   6 +
 lib/extras/Makefile                                |  30 ++
 lib/extras/NEWS                                    |  27 ++
 lib/extras/README.rst                              |  57 +++
 .../helpers.py => extras/extras/__init__.py}       |  52 +--
 lib/extras/extras/tests/__init__.py                |  17 +
 .../extras/tests/test_extras.py}                   |  37 +-
 lib/extras/setup.cfg                               |   4 +
 lib/extras/setup.py                                |  48 +++
 {buildtools/wafsamba => lib/mimeparse}/__init__.py |   0
 lib/mimeparse/mimeparse.py                         | 167 +++++++++
 lib/mimeparse/mimeparse_test.py                    |  68 ++++
 lib/mimeparse/setup.py                             |  50 +++
 lib/testtools/NEWS                                 | 410 +++++++++++++++++++++
 lib/update-external.sh                             |  15 +
 lib/wscript_build                                  |   5 +-
 pidl/lib/Parse/Pidl/Wireshark/Conformance.pm       |  10 +-
 pidl/tests/Util.pm                                 |   2 +-
 pidl/tests/wireshark-conf.pl                       |   2 +-
 python/samba/tests/subunitrun.py                   |  75 ++++
 selftest/filter-subunit                            |   2 +
 selftest/format-subunit                            |   2 +
 selftest/selftesthelpers.py                        |  10 +-
 source4/dsdb/tests/python/acl.py                   |  25 +-
 source4/dsdb/tests/python/deletetest.py            | 112 +++---
 source4/dsdb/tests/python/dirsync.py               |  25 +-
 source4/dsdb/tests/python/ldap_syntaxes.py         |  40 +-
 source4/dsdb/tests/python/password_lockout.py      | 189 +++++-----
 source4/dsdb/tests/python/passwords.py             | 232 ++++++------
 source4/dsdb/tests/python/sec_descriptor.py        |  36 +-
 source4/dsdb/tests/python/sites.py                 |  17 +-
 source4/dsdb/tests/python/token_group.py           |  20 +-
 source4/scripting/bin/subunitrun                   |  30 +-
 source4/scripting/devel/speedtest.py               |  18 +-
 source4/selftest/tests.py                          |  26 +-
 39 files changed, 1419 insertions(+), 533 deletions(-)
 create mode 100644 lib/extras/.gitignore
 copy lib/{testtools => extras}/.testr.conf (100%)
 copy lib/{ccan/time => extras}/LICENSE (77%)
 create mode 100644 lib/extras/MANIFEST.in
 create mode 100644 lib/extras/Makefile
 create mode 100644 lib/extras/NEWS
 create mode 100644 lib/extras/README.rst
 copy lib/{testtools/testtools/helpers.py => extras/extras/__init__.py} (74%)
 create mode 100644 lib/extras/extras/tests/__init__.py
 copy lib/{testtools/testtools/tests/test_helpers.py => extras/extras/tests/test_extras.py} (88%)
 create mode 100644 lib/extras/setup.cfg
 create mode 100755 lib/extras/setup.py
 copy {buildtools/wafsamba => lib/mimeparse}/__init__.py (100%)
 create mode 100644 lib/mimeparse/mimeparse.py
 create mode 100644 lib/mimeparse/mimeparse_test.py
 create mode 100644 lib/mimeparse/setup.py
 create mode 100755 python/samba/tests/subunitrun.py


Changeset truncated at 500 lines:

diff --git a/auth/credentials/tests/bind.py b/auth/credentials/tests/bind.py
index ceb3e8f..91e493d 100755
--- a/auth/credentials/tests/bind.py
+++ b/auth/credentials/tests/bind.py
@@ -5,24 +5,20 @@
 import optparse
 import sys
 import base64
-import re
-import os
 import copy
 import time
 
 sys.path.insert(0, "bin/python")
 import samba
-samba.ensure_external_module("testtools", "testtools")
-samba.ensure_external_module("subunit", "subunit/python")
+from samba.tests.subunitrun import SubunitOptions, TestProgram
 
 import samba.getopt as options
 
 from ldb import SCOPE_BASE, SCOPE_SUBTREE
 
 from samba import gensec
-import samba.tests, unittest
+import samba.tests
 from samba.tests import delete_force
-from subunit.run import SubunitTestRunner
 
 parser = optparse.OptionParser("ldap [options] <host>")
 sambaopts = options.SambaOptions(parser)
@@ -31,6 +27,8 @@ parser.add_option_group(sambaopts)
 # use command line creds if available
 credopts = options.CredentialsOptions(parser)
 parser.add_option_group(credopts)
+subunitopts = SubunitOptions(parser)
+parser.add_option_group(subunitopts)
 opts, args = parser.parse_args()
 
 if len(args) < 1:
@@ -53,8 +51,11 @@ class BindTests(samba.tests.TestCase):
     def setUp(self):
         super(BindTests, self).setUp()
         # fetch rootDSEs
+
+        self.ldb = samba.tests.connect_samdb(host, credentials=creds, lp=lp, ldap_only=True)
+
         if self.info_dc is None:
-            res = ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"])
+            res = self.ldb.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"])
             self.assertEquals(len(res), 1)
             BindTests.info_dc = res[0]
         # cache some of RootDSE props
@@ -70,8 +71,8 @@ class BindTests(samba.tests.TestCase):
 
     def test_computer_account_bind(self):
         # create a computer acocount for the test
-        delete_force(ldb, self.computer_dn)
-        ldb.add_ldif("""
+        delete_force(self.ldb, self.computer_dn)
+        self.ldb.add_ldif("""
 dn: """ + self.computer_dn + """
 cn: CENTOS53
 displayName: CENTOS53$
@@ -89,7 +90,7 @@ dNSHostName: centos53.alabala.test
 operatingSystemVersion: 5.2 (3790)
 operatingSystem: Windows Server 2003
 """)
-        ldb.modify_ldif("""
+        self.ldb.modify_ldif("""
 dn: """ + self.computer_dn + """
 changetype: modify
 replace: unicodePwd
@@ -106,8 +107,8 @@ unicodePwd:: """ + base64.b64encode("\"P at ssw0rd\"".encode('utf-16-le')) + """
 
     def test_user_account_bind(self):
         # create user
-        ldb.newuser(username=self.username, password=self.password)
-        ldb_res = ldb.search(base=self.domain_dn,
+        self.ldb.newuser(username=self.username, password=self.password)
+        ldb_res = self.ldb.search(base=self.domain_dn,
                                       scope=SCOPE_SUBTREE,
                                       expression="(samAccountName=%s)" % self.username)
         self.assertEquals(len(ldb_res), 1)
@@ -138,11 +139,4 @@ unicodePwd:: """ + base64.b64encode("\"P at ssw0rd\"".encode('utf-16-le')) + """
         res = ldb_user3.search(base="", expression="", scope=SCOPE_BASE, attrs=["*"])
 
 
-ldb = samba.tests.connect_samdb(host, credentials=creds, lp=lp, ldap_only=True)
-
-runner = SubunitTestRunner()
-rc = 0
-if not runner.run(unittest.makeSuite(BindTests)).wasSuccessful():
-    rc = 1
-
-sys.exit(rc)
+TestProgram(module=__name__, opts=subunitopts)
diff --git a/lib/extras/.gitignore b/lib/extras/.gitignore
new file mode 100644
index 0000000..cfc114c
--- /dev/null
+++ b/lib/extras/.gitignore
@@ -0,0 +1,35 @@
+*.py[co]
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+MANIFEST
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
+
+# editors
+*.swp
+*~
+
+# Testrepository
+.testrepository
diff --git a/lib/testtools/.testr.conf b/lib/extras/.testr.conf
similarity index 100%
copy from lib/testtools/.testr.conf
copy to lib/extras/.testr.conf
diff --git a/lib/ccan/time/LICENSE b/lib/extras/LICENSE
similarity index 77%
copy from lib/ccan/time/LICENSE
copy to lib/extras/LICENSE
index 89de354..4dfca45 100644
--- a/lib/ccan/time/LICENSE
+++ b/lib/extras/LICENSE
@@ -1,3 +1,12 @@
+Copyright (c) 2010-2012 the extras authors.
+
+The extras authors are:
+ * Jonathan Lange
+ * Martin Pool
+ * Robert Collins
+
+and are collectively referred to as "extras developers".
+
 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
@@ -5,13 +14,13 @@ 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 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.
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/lib/extras/MANIFEST.in b/lib/extras/MANIFEST.in
new file mode 100644
index 0000000..da2696e
--- /dev/null
+++ b/lib/extras/MANIFEST.in
@@ -0,0 +1,6 @@
+include LICENSE
+include Makefile
+include MANIFEST.in
+include NEWS
+include README.rst
+include .gitignore
diff --git a/lib/extras/Makefile b/lib/extras/Makefile
new file mode 100644
index 0000000..270e8d1
--- /dev/null
+++ b/lib/extras/Makefile
@@ -0,0 +1,30 @@
+# See README.rst for copyright and licensing details.
+
+PYTHON=python
+SOURCES=$(shell find extras -name "*.py")
+
+check:
+	PYTHONPATH=$(PWD) $(PYTHON) -m testtools.run extras.tests.test_suite
+
+TAGS: ${SOURCES}
+	ctags -e -R extras/
+
+tags: ${SOURCES}
+	ctags -R extras/
+
+clean:
+	rm -f TAGS tags
+	find extras -name "*.pyc" -exec rm '{}' \;
+
+### Documentation ###
+
+apidocs:
+	# pydoctor emits deprecation warnings under Ubuntu 10.10 LTS
+	PYTHONWARNINGS='ignore::DeprecationWarning' \
+		pydoctor --make-html --add-package extras \
+		--docformat=restructuredtext --project-name=extras \
+		--project-url=https://launchpad.net/extras
+
+
+.PHONY: apidocs
+.PHONY: check clean
diff --git a/lib/extras/NEWS b/lib/extras/NEWS
new file mode 100644
index 0000000..60713b8
--- /dev/null
+++ b/lib/extras/NEWS
@@ -0,0 +1,27 @@
+extras NEWS
++++++++++++
+
+Changes and improvements to extras_, grouped by release.
+
+NEXT
+~~~~
+
+0.0.3
+~~~~~
+
+* Extras setup.py would break on older testtools releases, which could break
+  installs of newer testtools due to extras then failing to install.
+  (Robert Collins)
+
+0.0.2
+~~~~~
+
+* Fix Makefile to not have cruft leftover from testtools.
+
+0.0.1
+~~~~~
+
+* Initial extraction from testtools.
+
+
+.. _extras: http://pypi.python.org/pypi/extras
diff --git a/lib/extras/README.rst b/lib/extras/README.rst
new file mode 100644
index 0000000..7d3f10b
--- /dev/null
+++ b/lib/extras/README.rst
@@ -0,0 +1,57 @@
+======
+extras
+======
+
+extras is a set of extensions to the Python standard library, originally
+written to make the code within testtools cleaner, but now split out for
+general use outside of a testing context.
+
+
+Documentation
+-------------
+
+pydoc extras is your friend. extras currently contains the following functions:
+
+* try_import
+
+* try_imports
+
+* safe_hasattr
+
+Which do what their name suggests.
+
+
+Licensing
+---------
+
+This project is distributed under the MIT license and copyright is owned by
+the extras authors. See LICENSE for details.
+
+
+Required Dependencies
+---------------------
+
+ * Python 2.6+ or 3.0+
+
+
+Bug reports and patches
+-----------------------
+
+Please report bugs using github issues at <https://github.com/testing-cabal/extras>.
+Patches can also be submitted via github.  You can mail the authors directly
+via the mailing list testtools-dev at lists.launchpad.net. (Note that Launchpad
+discards email from unknown addresses - be sure to sign up for a Launchpad
+account before mailing the list, or your mail will be silently discarded).
+
+
+History
+-------
+
+extras used to be testtools.helpers, and was factored out when folk wanted to
+use it separately.
+
+
+Thanks
+------
+
+ * Martin Pool
diff --git a/lib/testtools/testtools/helpers.py b/lib/extras/extras/__init__.py
similarity index 74%
copy from lib/testtools/testtools/helpers.py
copy to lib/extras/extras/__init__.py
index 2595c1d..5f16625 100644
--- a/lib/testtools/testtools/helpers.py
+++ b/lib/extras/extras/__init__.py
@@ -1,4 +1,8 @@
-# Copyright (c) 2010-2012 testtools developers. See LICENSE for details.
+# Copyright (c) 2010-2012 extras developers. See LICENSE for details.
+
+"""Extensions to the Python standard library."""
+
+import sys
 
 __all__ = [
     'safe_hasattr',
@@ -6,7 +10,19 @@ __all__ = [
     'try_imports',
     ]
 
-import sys
+# same format as sys.version_info: "A tuple containing the five components of
+# the version number: major, minor, micro, releaselevel, and serial. All
+# values except releaselevel are integers; the release level is 'alpha',
+# 'beta', 'candidate', or 'final'. The version_info value corresponding to the
+# Python version 2.0 is (2, 0, 0, 'final', 0)."  Additionally we use a
+# releaselevel of 'dev' for unreleased under-development code.
+#
+# If the releaselevel is 'alpha' then the major/minor/micro components are not
+# established at this point, and setup.py will use a version of next-$(revno).
+# If the releaselevel is 'final', then the tarball will be major.minor.micro.
+# Otherwise it is major.minor.micro~$(revno).
+
+__version__ = (0, 0, 3, 'final', 0)
 
 
 def try_import(name, alternative=None, error_callback=None):
@@ -85,35 +101,3 @@ def safe_hasattr(obj, attr, _marker=object()):
     properties.
     """
     return getattr(obj, attr, _marker) is not _marker
-
-
-def map_values(function, dictionary):
-    """Map ``function`` across the values of ``dictionary``.
-
-    :return: A dict with the same keys as ``dictionary``, where the value
-        of each key ``k`` is ``function(dictionary[k])``.
-    """
-    return dict((k, function(dictionary[k])) for k in dictionary)
-
-
-def filter_values(function, dictionary):
-    """Filter ``dictionary`` by its values using ``function``."""
-    return dict((k, v) for k, v in dictionary.items() if function(v))
-
-
-def dict_subtract(a, b):
-    """Return the part of ``a`` that's not in ``b``."""
-    return dict((k, a[k]) for k in set(a) - set(b))
-
-
-def list_subtract(a, b):
-    """Return a list ``a`` without the elements of ``b``.
-
-    If a particular value is in ``a`` twice and ``b`` once then the returned
-    list then that value will appear once in the returned list.
-    """
-    a_only = list(a)
-    for x in b:
-        if x in a_only:
-            a_only.remove(x)
-    return a_only
diff --git a/lib/extras/extras/tests/__init__.py b/lib/extras/extras/tests/__init__.py
new file mode 100644
index 0000000..e0d7d4a
--- /dev/null
+++ b/lib/extras/extras/tests/__init__.py
@@ -0,0 +1,17 @@
+# Copyright (c) 2010-2012 extras developers. See LICENSE for details.
+
+"""Tests for extras."""
+
+from unittest import TestSuite, TestLoader
+
+
+def test_suite():
+    from extras.tests import (
+        test_extras,
+        )
+    modules = [
+        test_extras,
+        ]
+    loader = TestLoader()
+    suites = map(loader.loadTestsFromModule, modules)
+    return TestSuite(suites)
diff --git a/lib/testtools/testtools/tests/test_helpers.py b/lib/extras/extras/tests/test_extras.py
similarity index 88%
copy from lib/testtools/testtools/tests/test_helpers.py
copy to lib/extras/extras/tests/test_extras.py
index 98da534..33dc87c 100644
--- a/lib/testtools/testtools/tests/test_helpers.py
+++ b/lib/extras/extras/tests/test_extras.py
@@ -1,23 +1,18 @@
-# Copyright (c) 2010-2012 testtools developers. See LICENSE for details.
+# Copyright (c) 2010-2012 extras developers. See LICENSE for details.
 
 from testtools import TestCase
-from testtools.helpers import (
-    try_import,
-    try_imports,
-    )
 from testtools.matchers import (
     Equals,
     Is,
     Not,
     )
-from testtools.tests.helpers import (
-    FullStackRunTest,
-    hide_testtools_stack,
-    is_stack_hidden,
+
+from extras import (
     safe_hasattr,
+    try_import,
+    try_imports,
     )
 
-
 def check_error_callback(test, function, arg, expected_error_count,
     expect_result):
     """General test template for error_callback argument.
@@ -189,25 +184,3 @@ class TestTryImports(TestCase):
         check_error_callback(self, try_imports,
             ['os.path'],
             0, True)
-
-
-class TestStackHiding(TestCase):
-
-    run_tests_with = FullStackRunTest
-
-    def setUp(self):
-        super(TestStackHiding, self).setUp()
-        self.addCleanup(hide_testtools_stack, is_stack_hidden())
-
-    def test_is_stack_hidden_consistent_true(self):
-        hide_testtools_stack(True)
-        self.assertEqual(True, is_stack_hidden())
-
-    def test_is_stack_hidden_consistent_false(self):
-        hide_testtools_stack(False)
-        self.assertEqual(False, is_stack_hidden())
-
-
-def test_suite():
-    from unittest import TestLoader
-    return TestLoader().loadTestsFromName(__name__)
diff --git a/lib/extras/setup.cfg b/lib/extras/setup.cfg
new file mode 100644
index 0000000..c319dc7
--- /dev/null
+++ b/lib/extras/setup.cfg
@@ -0,0 +1,4 @@
+[test]
+test_module = extras.tests
+buffer=1
+catch=1
diff --git a/lib/extras/setup.py b/lib/extras/setup.py
new file mode 100755
index 0000000..56612d0
--- /dev/null
+++ b/lib/extras/setup.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python


-- 
Samba Shared Repository


More information about the samba-cvs mailing list