/usr/share/pyshared/zope.testing-3.10.2.egg-info/PKG-INFO is in python-zope.testing 3.10.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | Metadata-Version: 1.0
Name: zope.testing
Version: 3.10.2
Summary: Zope testing helpers
Home-page: http://pypi.python.org/pypi/zope.testing
Author: Zope Foundation and Contributors
Author-email: zope-dev@zope.org
License: ZPL 2.1
Description: ************
zope.testing
************
.. contents::
This package provides a number of testing frameworks. It includes a
flexible test runner, and supports both doctest and unittest.
cleanup.py
Provides a mixin class for cleaning up after tests that
make global changes.
doctest.py
Enhanced version of python's standard doctest.py.
Better test count (one per block instead of one per docstring).
See doctest.txt.
(We need to merge this with the standard doctest module.)
doctestunit.py
Provides a pprint function that always sorts dictionary entries
(pprint.pprint from the standard library doesn't sort very short ones,
sometimes causing test failures when the internal order changes).
formparser.py
An HTML parser that extracts form information.
This is intended to support functional tests that need to extract
information from HTML forms returned by the publisher.
See formparser.txt.
loggingsupport.py
Support for testing logging code
If you want to test that your code generates proper log output, you
can create and install a handler that collects output.
loghandler.py
Logging handler for tests that check logging output.
module.py
Lets a doctest pretend to be a Python module.
See module.txt.
renormalizing.py
Regular expression pattern normalizing output checker.
Useful for doctests.
server.py
Provides a simple HTTP server compatible with the zope.app.testing
functional testing API. Lets you interactively play with the system
under test. Helpful in debugging functional doctest failures.
setupstack.py
A simple framework for automating doctest set-up and tear-down.
See setupstack.txt.
testrunner
The test runner package. This is typically wrapped by a test.py script that
sets up options to run a particular set of tests.
Getting started
***************
zope.testing uses buildout. To start, run ``python bootstrap.py``. It will
create a number of directories and the ``bin/buildout`` script. Next, run
``bin/buildout``. It will create a test script for you. Now, run ``bin/test``
to run the zope.testing test suite.
zope.testing Changelog
**********************
3.10.2 (2010-11-30)
===================
- Fix test of broken symlink handling to not break on Windows.
3.10.1 (2010-11-29)
===================
- Fix removal of broken symlinks on Unix.
3.10.0 (2010-07-21)
===================
- Removed zope.testing.testrunner, which now is moved to zope.testrunner.
- Update fix for LP #221151 to a spelling compatible with Python 2.4.
3.9.5 (2010-05-19)
==================
- LP #579019: When layers were run in parallel, their tearDown was not
called. Additionally, the first layer which was run in the main
thread did not have it's tearDown called either.
- Deprecated zope.testing.testrunner and zope.testing.exceptions. They have
been moved to a separate zope.testrunner module, and will be removed from
zope.testing in 4.0.0, together with zope.testing.doctest.
3.9.4 (2010-04-13)
==================
- LP #560259: Fix subunit output formatter to handle layer setup
errors.
- LP #399394: Added a ``--stop-on-error`` / ``--stop`` / ``-x`` option to
the testrunner.
- LP #498162: Added a ``--pdb`` alias for the existing ``--post-mortem``
/ ``-D`` option to the testrunner.
- LP #547023: Added a ``--version`` option to the testrunner.
- Added tests for LP #144569 and #69988.
https://bugs.launchpad.net/bugs/69988
https://bugs.launchpad.net/zope3/+bug/144569
3.9.3 (2010-03-26)
==================
- zope.testing.renormalizer no longer imports zope.testing.doctest, which
caused deprecation warnings.
- Fix testrunner-layers-ntd.txt to suppress output to sys.stderr.
- Suppress zope.testing.doctest deprecation warning when running
zope.testing's own test suite.
3.9.2 (2010-03-15)
==================
- Fixed broken ``from zope.testing.doctest import *``
3.9.1 (2010-03-15)
==================
- No changes; reuploaded to fix broken 3.9.0 release on PyPI.
3.9.0 (2010-03-12)
==================
- Modified the testrunner to use the standard Python doctest module instead of
the deprecated zope.testing.doctest.
- Fix testrunner-leaks.txt to use the run_internal helper, so that
sys.exit() isn't triggered during the test run.
- Added support for conditionally using a subunit-based output
formatter upon request if subunit and testtools are available. Patch
contributed by Jonathan Lange.
3.8.7 (2010-01-26)
==================
- Downgraded the zope.testing.doctest deprecation warning into a
PendingDeprecationWarning.
3.8.6 (2009-12-23)
==================
- Added MANIFEST.in and reuploaded to fix broken 3.8.5 release on PyPI.
3.8.5 (2009-12-23)
==================
- Added DocFileSuite, DocTestSuite, debug_src and debug back BBB imports
back into zope.testing.doctestunit; apparently many packages still import
them from there!
- Made zope.testing.doctest and zope.testing.doctestunit emit deprecation
warnings: use the stdlib doctest instead.
3.8.4 (2009-12-18)
==================
- Fixed missing imports and undefined variables reported by pyflakes,
adding tests to exercise the blind spots.
- Cleaned up unused imports reported by pyflakes.
- Added two new options to generate randomly ordered list of tests and to
select a specific order of tests.
- RENormalizing checkers can be combined via ``+`` now:
``checker1 + checker2`` creates a checker with the transformations of both
checkers.
- Test fixes for Python 2.7.
3.8.3 (2009-09-21)
==================
- Avoid a split() call or we get test failures when running from a directory
with spaces in it.
- Fix testrunner behavior on Windows for -j2 (or greater) combined with -v
(or greater).
3.8.2 (2009-09-15)
==================
- Removing hotshot profiler when using Python 2.6. That makes zope.testing
compatible with Python 2.6
3.8.1 (2009-08-12)
==================
- Avoid hardcoding sys.argv[0] as script;
allow, for instance, Zope 2's `bin/instance test` (LP#407916).
- Produce a clear error message when a subprocess doesn't follow the
zope.testing.testrunner protocol (LP#407916).
- Do not unnecessarily squelch verbose output in a subprocess when there are
not multiple subprocesses.
- Do not unnecessarily batch subprocess output, which can stymie automated and
human processes for identifying hung tests.
- Include incremental output when there are multiple subprocesses and a
verbosity of -vv or greater is requested. This again is not batched,
supporting automated processes and humans looking for hung tests.
3.8.0 (2009-07-24)
==================
- Testrunner automatically picks up descendants of unittest.TestCase in test
modules, so you don't have to provide a test_suite() anymore.
3.7.7 (2009-07-15)
==================
- Clean up support for displaying tracebacks with supplements by turning it
into an always-enabled feature and making the dependency on zope.exceptions
explicit.
- Fix #251759: Test runner descended into directories that aren't Python
packages.
- Code cleanups.
3.7.6 (2009-07-02)
==================
- Add zope-testrunner console_scripts entry point. This exposes a
zope-testrunner binary with default installs allowing the testrunner to be
run from the command line.
3.7.5 (2009-06-08)
==================
- Fix bug when running subprocesses on Windows.
- The option REPORT_ONLY_FIRST_FAILURE (command line option "-1") is now
respected even when a doctest declares its own REPORTING_FLAGS, such as
REPORT_NDIFF.
- Fixed bug that broke readline with pdb when using doctest
(see http://bugs.python.org/issue5727).
- Made tests pass on Windows and Linux at the same time.
3.7.4 (2009-05-01)
==================
- Filenames of doctest examples now contain the line number and not
only the example number. So a stack trace in pdb tells the exact
line number of the current example. This fixes
https://bugs.launchpad.net/bugs/339813
- Colorization of doctest output correctly handles blank lines.
3.7.3 (2009-04-22)
==================
- Better deal with rogue threads by always exiting with status so even
spinning daemon threads won't block the runner from exiting. This deprecated
the ``--with-exit-status`` option.
3.7.2 (2009-04-13)
==================
- fix test failure on Python 2.4 because of slight difference in the way
coverage is reported (__init__ files with only a single comment line are now
not reported)
- fixed bug that caused the test runner to hang when running subprocesses (as a
result Python 2.3 is no longer supported).
- there is apparently a bug in Python 2.6 (related to
http://bugs.python.org/issue1303673) that causes the profile tests to fail.
- added explanitory notes to buildout.cfg about how to run the tests with
multiple versions of Python
3.7.1 (2008-10-17)
==================
- The setupstack temporary-directory support now properly handles
read-only files by making them writable before removing them.
3.7.0 (2008-09-22)
==================
- Added an alterate setuptools / distutils commands for running all tests
using our testrunner. See 'zope.testing.testrunner.eggsupport:ftest'.
- Added a setuptools-compatible test loader which skips tests with layers:
the testrunner used by 'setup.py test' doesn't know about them, and those
tests then fail. See 'zope.testing.testrunner.eggsupport:SkipLayers'.
- Added support for Jython, when a garbage collector call is sent.
- Added support to bootstrap on Jython.
- Fixed NameError in StartUpFailure.
- Open doctest files in universal mode, so that packages released on Windows
can be tested on Linux, for example.
3.6.0 (2008/07/10)
==================
- Added -j option to parallel tests run in subprocesses.
- RENormalizer accepts plain Python callables.
- Added --slow-test option.
- Added --no-progress and --auto-progress options.
- Complete refactoring of the test runner into multiple code files and a more
modular (pipeline-like) architecture.
- Unified unit tests with the layer support by introducing a real unit test
layer.
- Added a doctest for ``zope.testing.module``. There were several bugs
that were fixed:
* ``README.txt`` was a really bad default argument for the module
name, as it is not a proper dotted name. The code would
immediately fail as it would look for the ``txt`` module in the
``README`` package. The default is now ``__main__``.
* The tearDown function did not clean up the ``__name__`` entry in the
global dictionary.
- Fix a bug that caused a SubprocessError to be generated if a subprocess
sent any output to stderr.
- Fix a bug that caused the unit tests to be skipped if run in a subprocess.
3.5.1 (2007/08/14)
==================
Bugs Fixed:
-----------
- Post-mortem debugging wasn't invoked for layer-setup failures.
3.5.0 (2007/07/19)
==================
New Features
------------
- The test runner now works on Python 2.5.
- Added support for cProfile.
- Added output colorizing (-c option).
- Added --hide-secondary-failures and --show-secondary-failures options
(https://bugs.launchpad.net/zope3/+bug/115454).
Bugs Fixed:
-----------
- Fix some problems with Unicode in doctests.
- Fix "Error reading from subprocess" errors on Unix-like systems.
3.4 (2007/03/29)
================
New Features
------------
- Added exit-with-status support (supports use with buildbot and
zc.recipe.testing)
- Added a small framework for automating set up and tear down of
doctest tests. See setupstack.txt.
Bugs Fixed:
-----------
- Fix testrunner-wo-source.txt and testrunner-errors.txt to run with a
read-only source tree.
3.0 (2006/09/20)
================
- Updated the doctest copy with text-file encoding support.
- Added logging-level support to loggingsuppport module.
- At verbosity-level 1, dots are not output continuously, without any
line breaks.
- Improved output when the inability to tear down a layer causes tests
to be run in a subprocess.
- Made zope.exception required only if the zope_tracebacks extra is
requested.
2.x.y (???)
===========
- Fix the test coverage. If a module, for example `interfaces`, was in an
ignored directory/package, then if a module of the same name existed in a
covered directory/package, then it was also ignored there, because the
ignore cache stored the result by module name and not the filename of the
module.
2.0 (2006/01/05)
================
- Corresponds to the version of the zope.testing package shipped as part of
the Zope 3.2.0 release.
Detailed Documentation
**********************
Parsing HTML Forms
==================
Sometimes in functional tests, information from a generated form must
be extracted in order to re-submit it as part of a subsequent request.
The `zope.testing.formparser` module can be used for this purpose.
The scanner is implemented using the `FormParser` class. The
constructor arguments are the page data containing the form and
(optionally) the URL from which the page was retrieved:
>>> import zope.testing.formparser
>>> page_text = '''\
... <html><body>
... <form name="form1" action="/cgi-bin/foobar.py" method="POST">
... <input type="hidden" name="f1" value="today" />
... <input type="submit" name="do-it-now" value="Go for it!" />
... <input type="IMAGE" name="not-really" value="Don't."
... src="dont.png" />
... <select name="pick-two" size="3" multiple>
... <option value="one" selected>First</option>
... <option value="two" label="Second">Another</option>
... <optgroup>
... <option value="three">Third</option>
... <option selected="selected">Fourth</option>
... </optgroup>
... </select>
... </form>
...
... Just for fun, a second form, after specifying a base:
... <base href="http://www.example.com/base/" />
... <form action = 'sproing/sprung.html' enctype="multipart/form">
... <textarea name="sometext" rows="5">Some text.</textarea>
... <input type="Image" name="action" value="Do something."
... src="else.png" />
... <input type="text" value="" name="multi" size="2" />
... <input type="text" value="" name="multi" size="3" />
... </form>
... </body></html>
... '''
>>> parser = zope.testing.formparser.FormParser(page_text)
>>> forms = parser.parse()
>>> len(forms)
2
>>> forms.form1 is forms[0]
True
>>> forms.form1 is forms[1]
False
More often, the `parse()` convenience function is all that's needed:
>>> forms = zope.testing.formparser.parse(
... page_text, "http://cgi.example.com/somewhere/form.html")
>>> len(forms)
2
>>> forms.form1 is forms[0]
True
>>> forms.form1 is forms[1]
False
Once we have the form we're interested in, we can check form
attributes and individual field values:
>>> form = forms.form1
>>> form.enctype
'application/x-www-form-urlencoded'
>>> form.method
'post'
>>> keys = form.keys()
>>> keys.sort()
>>> keys
['do-it-now', 'f1', 'not-really', 'pick-two']
>>> not_really = form["not-really"]
>>> not_really.type
'image'
>>> not_really.value
"Don't."
>>> not_really.readonly
False
>>> not_really.disabled
False
Note that relative URLs are converted to absolute URLs based on the
``<base>`` element (if present) or using the base passed in to the
constructor.
>>> form.action
'http://cgi.example.com/cgi-bin/foobar.py'
>>> not_really.src
'http://cgi.example.com/somewhere/dont.png'
>>> forms[1].action
'http://www.example.com/base/sproing/sprung.html'
>>> forms[1]["action"].src
'http://www.example.com/base/else.png'
Fields which are repeated are reported as lists of objects that
represent each instance of the field::
>>> field = forms[1]["multi"]
>>> type(field)
<type 'list'>
>>> [o.value for o in field]
['', '']
>>> [o.size for o in field]
[2, 3]
The ``<textarea>`` element provides some additional attributes:
>>> ta = forms[1]["sometext"]
>>> print ta.rows
5
>>> print ta.cols
None
>>> ta.value
'Some text.'
The ``<select>`` element provides access to the options as well:
>>> select = form["pick-two"]
>>> select.multiple
True
>>> select.size
3
>>> select.type
'select'
>>> select.value
['one', 'Fourth']
>>> options = select.options
>>> len(options)
4
>>> [opt.label for opt in options]
['First', 'Second', 'Third', 'Fourth']
>>> [opt.value for opt in options]
['one', 'two', 'three', 'Fourth']
Stack-based test doctest setUp and tearDown
============================================
Writing doctest setUp and tearDown functions can be a bit tedious,
especially when setUp/tearDown functions are combined.
the zope.testing.setupstack module provides a small framework for
automating test tear down. It provides a generic setUp function that
sets up a stack. Normal test setUp functions call this function to set
up the stack and then use the register function to register tear-down
functions.
To see how this works we'll create a faux test:
>>> class Test:
... def __init__(self):
... self.globs = {}
>>> test = Test()
We'll register some tearDown functions that just print something:
>>> import sys
>>> import zope.testing.setupstack
>>> zope.testing.setupstack.register(
... test, lambda : sys.stdout.write('td 1\n'))
>>> zope.testing.setupstack.register(
... test, lambda : sys.stdout.write('td 2\n'))
Now, when we call the tearDown function:
>>> zope.testing.setupstack.tearDown(test)
td 2
td 1
The registered tearDown functions are run. Note that they are run in
the reverse order that they were registered.
Extra positional arguments can be passed to register:
>>> zope.testing.setupstack.register(
... test, lambda x, y, z: sys.stdout.write('%s %s %s\n' % (x, y, z)),
... 1, 2, z=9)
>>> zope.testing.setupstack.tearDown(test)
1 2 9
Temporary Test Directory
------------------------
Often, tests create files as they demonstrate functionality. They
need to arrange for the removeal of these files when the test is
cleaned up.
The setUpDirectory function automates this. We'll get the current
directory first:
>>> import os
>>> here = os.getcwd()
We'll also create a new test:
>>> test = Test()
Now we'll call the setUpDirectory function:
>>> zope.testing.setupstack.setUpDirectory(test)
We don't have to call zope.testing.setupstack.setUp, because
setUpDirectory calls it for us.
Now the current working directory has changed:
>>> here == os.getcwd()
False
We can create files to out heart's content:
>>> open('Data.fs', 'w').write('xxx')
>>> os.path.exists('Data.fs')
True
We'll make the file read-only. This can cause problems on Windows, but
setupstack takes care of that by making files writable before trying
to remove them.
>>> import stat
>>> os.chmod('Data.fs', stat.S_IREAD)
On Unix systems, broken symlinks can cause problems because the chmod
attempt by the teardown hook will fail; let's set up a broken symlink as
well, and verify the teardown doesn't break because of that:
>>> if hasattr(os, 'symlink'):
... os.symlink('NotThere', 'BrokenLink')
When tearDown is called:
>>> zope.testing.setupstack.tearDown(test)
We'll be back where we started:
>>> here == os.getcwd()
True
and the files we created will be gone (along with the temporary
directory that was created:
>>> os.path.exists('Data.fs')
False
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.4
Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Testing
|