summaryrefslogtreecommitdiff
path: root/testtools/tests
Commit message (Collapse)AuthorAgeFilesLines
* Add testscenarios for use by tests.Robert Collins2015-11-191-2/+4
| | | | Change-Id: I76ba3261129736a714d7b265d21a29264f1c2974
* Remove VWSJonathan Lange2015-11-061-3/+0
|
* Lint clear-upJonathan Lange2015-11-021-5/+15
|
* Fix tests with unittest2 1.1.0 and higher.Robert Collins2015-07-011-0/+1
| | | | Change-Id: I4613d47852fbf901819f197f6e388ccaa717b53e
* Add some custom matchers to make deferred log tests more readable.Colin Watson2015-04-041-26/+73
|
* Rewind the deferred test log before attaching it.Colin Watson2015-04-021-2/+11
| | | | | | Since the StringIO buffer is positioned at end-of-file after the underlying test finishes, the twisted-log detail was previously always empty.
* Fix output of empty attachments.Robert Collins2015-03-101-0/+47
| | | | | | | | | Empty attachments to tests were triggering a file payload of None in the ``ExtendedToStreamDecorator`` code, which caused multiple copies of attachments that had been output prior to the empty one. (Robert Collins, #1378609) Change-Id: I34a989546d57b245d4384b8c5b6d444e7ce0ac1b
* Overhaul exception reporting.Robert Collins2015-03-105-327/+58
| | | | | | | | | | | unittest2 recently added the ability to show local variables in tracebacks as https://github.com/testing-cabal/testtools/issues/111 requested for us. Reusing that requires some refactoring of our code, in particular where we were reimplementing bits of the traceback module. Now we can just hard-depend on traceback2 and linecache2 which are brought in by unittest2 1.0.0. Change-Id: Ieb3268029d26b48ed4fcd25ed644bd339f6aa3fb
* Show import error details.Robert Collins2014-11-181-5/+40
| | | | | | | | When an import error happens ``testtools.run`` will now show the full error rather than just the name of the module that failed to import. (Robert Collins) Change-Id: I2d9d7a4659b51a5e3ea8000301ecb799ed30f463
* Fix setUpClass upcalls on Python 2.6.Robert Collins2014-11-172-22/+44
| | | | | | | | ``testtools.TestCase`` now inherits from unittest2.TestCase, which provides a ``setUpClass`` for upcalls on Python 2.6. (Robert Collins, #1393283) Change-Id: Id56212e3d7d519c7b73d2e19d3e34013fac34544
* Fix skipping setUpClass with self.skipExceptionRobert Collins2014-11-161-0/+18
| | | | Change-Id: I1f314c91c4e852edafabc7cf3d2b01abe8a62fa3
* Use unittest2 TestProgram implementation.Robert Collins2014-11-141-4/+6
| | | | | | | | This brings in many fixes made to discovery where previously we were only using the discovery package or the version in the release of Python that the test execution was occuring on. (Robert Collins, #1271133) Change-Id: I6270c8e8949262c01cb3a4e40735077ad6fc1ef2
* Make discover run the same tests as 'make test'.Robert Collins2014-11-071-4/+7
| | | | | | | We use test parameterisation in test_deferredruntest, but hadn't defined a load_tests hook to inform discover of that. Change-Id: Ib32d7cf88b1a9e311476a5286357e46e65de1f1f
* Improve support for discovery on testtools.tests.Robert Collins2014-11-073-6/+7
| | | | | | | | | | | Our tests currently import test_with_with into test_testcase so that we could still run tests on python2.5. Since we no longer support 2.5, we don't need this hack. Its a hack because discovery will import test_with_with directly itself, and thus we triggered a duplicate test id error when attempting to use discover on the testtools test base. Change-Id: I027929ab4b0df350dd18ab01ffd5c493fe35e101
* Make text_content more explicit about the types that it accepts.Thomi Richards2014-10-161-0/+11
|
* Fix unit tests which failed under pypy due to a change in the way tracebacks ↵Thomi Richards2014-10-151-14/+25
| | | | were reported.
* Fix masking of fixture.setUp errors.Robert Collins2014-09-121-0/+27
| | | | | | | | Exceptions in a ``fixture.getDetails`` method will no longer mask errors raised from the same fixture's ``setUp`` method. (Robert Collins, #1368440) Change-Id: I39da334ba57683fd71a5d7af16c32d9170f6e626
* Fix handling of uncatchable exceptions.Robert Collins2014-09-023-14/+68
| | | | | | | | | | | | | | | | | Fix a long-standing bug where tearDown and cleanUps would not be called if the test run was interrupted. This should fix leaking external resources from interrupted tests. (Robert Collins, #1364188) Fix a long-standing bug where calling sys.exit(0) from within a test would cause the test suite to exit with 0, without reporting a failure of that test. We still allow the test suite to be exited (since catching higher order exceptions requires exceptional circumstances) but we now call a last-resort handler on the TestCase, resulting in an error being reported for the test. (Robert Collins, #1364188) Change-Id: I0700f33fe7ed01416b37c21eb3f3fd0a7ea917eb
* Fix issue where using the skip* family of decorators still ran the setUp and ↵Thomi Richards2014-09-011-0/+71
| | | | tearDown test methods.
* Backport fix for load_tests in package modules.Robert Collins2014-08-281-2/+44
| | | | | | | | | Discover was not executing load_tests at the package level, in contrast to the docs which suggested it was possible. This is a backport of the Python upstream proposed fix. Change-Id: Ib952d5ce4ae1a3da0cd27dcf09315d20055d6b5a Closes-Bug: http://bugs.python.org/issue16662
* Honour stdout on TestProgram more fully.Robert Collins2014-08-242-4/+23
| | | | | | | | We were failing to pass it into the runner, and this causes hilarity for child runners which then end up with sys.stdout in their test suite, rather than their stub streams. Change-Id: I19984102547f92493f330059928f7e0b3897c38c
* Handle content objects betterRobert Collins2014-08-241-3/+1
| | | | | | | | | The ``ExtendedToStreamDecorator`` now handles content objects with one less packet - the last packet of the source content is sent with EOF set rather than an empty packet with EOF set being sent after the last packet of the source content. Change-Id: If908c1fe8e6fbe2ac3834a1cd99e7cd8ace45b3b
* Error if setUp or tearDown are called twice.Robert Collins2014-08-221-0/+24
| | | | | | | TestCase.setUp and TestCase.tearDown are only meant to be called once. Change-Id: If39046eed35257938062b07655b50d9bef0ea5ee Closes-Bug: #882884
* abandoned pull request revived to comply with comments in reviewChris Gagnon2014-05-271-3/+1
|
* Merge https://github.com/testing-cabal/testtoolsChris Gagnon2014-05-272-1/+185
|\ | | | | | | | | | | | | | | Conflicts: NEWS doc/for-test-authors.rst testtools/testcase.py testtools/tests/test_testcase.py
| * Merge pull request #82 from thomir/fix-expectedFailureJonathan Lange2014-05-261-0/+22
| |\ | | | | | | Fix expected failure
| | * Added failing test for python 3.4 unittest.expectedFailure decorator changes.Thomi Richards2014-03-101-0/+22
| | |
| * | Raise a TypeError when text_content is passed bytes, so we get an error as ↵Thomi Richards2014-05-161-1/+7
| | | | | | | | | | | | early as possible.
| * | Add optional message to assert(Not)InJoe Gordon2014-02-141-0/+22
| |/ | | | | | | | | Just like many other asserts, add an optional message to assertIn and assertNotIn. This allows for more descriptive failures.
| * Add expectThat method to testtools.TestCase.Thomi Richards2013-12-091-0/+32
| | | | | | | | Change-Id: I387df10140fe76af03d2ec693b35e326b2da932e
* | Move assertThat tests to separate module and apply them to assert_that as well.Daniel Watkins2013-12-043-102/+156
|/
* Revert "Workaround 2.4 threading bug in test_spinner."Daniel Watkins2013-12-031-8/+1
| | | | This reverts commit ba8af964e7e2b7378e21874c4383870b82bd1599.
* Remove Python 2.4 deprecation warning special-casing.Daniel Watkins2013-12-031-8/+0
|
* Remove (always skipped) test for string exceptions.Daniel Watkins2013-12-031-9/+0
|
* Remove another Python 2.4 special case.Daniel Watkins2013-12-031-1/+1
|
* We no longer need to handle Python 2.4's KeyboardInterrupt specially.Daniel Watkins2013-12-031-6/+1
|
* Remove trailing whitespace.Daniel Watkins2013-12-031-1/+1
|
* Fix test_bom Python 3.3 test failureMartin Packman2013-11-301-1/+2
| | | | | | | | Adapt test_compat.TestDetectEncoding.test_bom to skip compile step on corner case that is no longer valid on Python 3.3 and later. Change-Id: Ia4d5949363ca4cea603c2a0847742a1df8f68709
* In Python 3.3, if there are duplicate test ids, tests.sort() willKui Shi2013-11-281-0/+20
| | | | | | | fail and raise TypeError. Detect the duplicate test ids firstly in sorted_tests() to ensure that all test ids are unique.
* Add 'force_failure' feature to testtools.TestCase.Thomi Richards2013-11-281-0/+10
| | | | Change-Id: Idb8c8d0c837ab2cb6ec53c84d144c29b5d6da8ea
* Add testtools.StacktraceContent.Thomi Richards2013-11-261-0/+28
|
* Indicate failed imports in list-tests.Robert Collins2013-11-251-4/+25
| | | | | | | | | | | Test listing now explicitly indicates by printing 'Failed to import' and exiting (2) when an import has failed rather than only signalling through the test name. This plus the introduction of a public helper lays the groundwork for fixing a usability bug in testrepository caused by the interaction between failed listings and user test filters. Change-Id: I7fb8cb70c515c54d8febd68ba791c27db0a7a9c4 Closes-Bug: #1245672
* Be more paranoid about list-tests behaviour.Robert Collins2013-11-241-8/+24
| | | | | | | | In test_run we were assuming that testtools.run -l wouldn't be evil and call sys.exit(), but calling sys.exit() is the contract of TestProgram, so we should be paranoid about it. Change-Id: I72d81942322eb9c1d57356741fa0f3806ebf14e8
* Cleanup sys.modules correctly in test_run.Robert Collins2013-11-241-0/+2
| | | | | | We were leaving testtools.runexample behind which breaks test isolation. Change-Id: I500c20317183596d28f09c0b5a62b03f5f009e4f
* run network test on the loopback interface onlyBenedikt Morbach2013-11-242-5/+5
| | | | | | | | We have a sandbox for building packages that doesn't allow this and it seems to be a good idea in general not to bind to all interfaces, some of which will be reachable from other machines to run simple tests. Change-Id: I6cf82d6bd67437dc29d7f9d6c886dadb6e6d8f95
* Fix StreamSummary counting of testsRun.Robert Collins2013-11-051-1/+2
| | | | | | | | StreamSummary was calculating testsRun incorrectly: exists status tests were counted as run tests, but they are not. Change-Id: I9581be45e878a4281904e2039dd7790f9bc1a3bb Closes-Bug: #1203728
* Add StackLinesContent, reimplement TracebackContent to use this new class.Thomi Richards2013-10-252-4/+48
|
* Merge pull request #49 from thomir/refactor-compat-functionJonathan Lange2013-10-211-0/+150
|\ | | | | Refactor testtools.compat._format_exc_info into two separate functions.
| * Refactor testtools.compat._format_exc_info into two separate functions.Thomi Richards2013-10-211-0/+150
| |
* | Add the 'addDetailUniqueName' method to TestCase.Thomi Richards2013-10-181-0/+9
|/