~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/tests/cmdline/svntest/testcase.py

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import svntest
29
29
 
30
30
# if somebody does a "from testcase import *", they only get these names
31
 
__all__ = ['_XFail', '_Wimp', '_Skip', '_SkipUnless']
 
31
__all__ = ['_XFail', '_Wimp', '_Skip', '_SkipUnless',
 
32
           '_SkipDumpLoadCrossCheck']
32
33
 
33
34
RESULT_OK = 'ok'
34
35
RESULT_FAIL = 'fail'
135
136
  is derived from the file name in which FUNC was defined)
136
137
  """
137
138
 
138
 
  def __init__(self, func, issues=None):
 
139
  def __init__(self, func, issues=None, skip_cross_check=False):
139
140
    # it better be a function that accepts an sbox parameter and has a
140
141
    # docstring on it.
141
142
    assert isinstance(func, types.FunctionType)
161
162
 
162
163
    TestCase.__init__(self, doc=doc, issues=issues)
163
164
    self.func = func
 
165
    self.skip_cross_check = skip_cross_check
164
166
 
165
167
  def get_function_name(self):
166
168
    return self.func.func_name
173
175
    return os.path.splitext(os.path.basename(filename))[0]
174
176
 
175
177
  def run(self, sandbox):
176
 
    return self.func(sandbox)
 
178
    result = self.func(sandbox)
 
179
    sandbox.verify(skip_cross_check = self.skip_cross_check)
 
180
    return result
177
181
 
178
182
 
179
183
class _XFail(TestCase):
261
265
    _Skip.__init__(self, test_case, lambda c=cond_func: not c())
262
266
 
263
267
 
264
 
def create_test_case(func, issues=None):
 
268
class _SkipDumpLoadCrossCheck(TestCase):
 
269
  """A test that will skip the post-test dump/load cross-check."""
 
270
 
 
271
  def __init__(self, test_case, cond_func=lambda: True, wip=None,
 
272
               issues=None):
 
273
    TestCase.__init__(self,
 
274
                      create_test_case(test_case, skip_cross_check=True),
 
275
                      cond_func, wip=wip, issues=issues)
 
276
 
 
277
 
 
278
def create_test_case(func, issues=None, skip_cross_check=False):
265
279
  if isinstance(func, TestCase):
266
280
    return func
267
281
  else:
268
 
    return FunctionTestCase(func, issues=issues)
 
282
    return FunctionTestCase(func, issues=issues,
 
283
                            skip_cross_check=skip_cross_check)
269
284
 
270
285
 
271
286
# Various decorators to make declaring tests as such simpler
322
337
 
323
338
  return _second
324
339
 
 
340
def SkipDumpLoadCrossCheck_deco(cond_func = lambda: True):
 
341
  def _second(func):
 
342
    if isinstance(func, TestCase):
 
343
      return _SkipDumpLoadCrossCheck(func, cond_func, issues=func.issues)
 
344
    else:
 
345
      return _SkipDumpLoadCrossCheck(func, cond_func)
 
346
 
 
347
  return _second
 
348
 
 
349
 
325
350
# Create a singular alias, for linguistic correctness
326
351
Issue_deco = Issues_deco