Commit Graph

23 Commits

Author SHA1 Message Date
Pedro Algarvio
f76facf045 Missed one logging handler method. 2012-12-11 12:57:06 +00:00
Pedro Algarvio
8c2cadcc13 Mimic some logging handler attributes and methods. 2012-12-11 12:18:48 +00:00
Pedro Algarvio
f51f35c148 Allow RedirectStdStreams to behave correctly using with. Allow flushing streams. 2012-12-01 22:59:43 +00:00
Pedro Algarvio
4fc12f58ee Fix salt.utils.fopen import error. 2012-11-23 12:33:28 +00:00
Pedro Algarvio
a6fd9bb60f Add tests.saltunittest.RedirectStdStreams.
* The `RedirectStdStreams` tests helper will allow to temporarily catch `stdout` and `stderr` output. Right now it's only used to **mute** the `tests.integration.runners.jobs.ManageTest.test_active()` output.
2012-11-23 12:19:09 +00:00
Pedro Algarvio
4fdd8f4b8b Make destructiveTest decorated tests work when passed with -n to runtests. 2012-11-20 12:22:23 +00:00
Pedro Algarvio
e8766b7b8d Allow certain tests to marked as destructive.
* Some tests might be considered destructive, such as adding or removing users from the system. This change allows those tests to be skipped unless stated otherwise.

```python

from saltunittest import destructiveTest

class ATestCase(TestCase):

    @destructiveTest
    def test_some_destructive_code(self):
        """Some destructive code."""

```

On the console we get something like:
```
test_destructive (unit.config_test.ConfigTestCase) ... skipped 'Destructive tests are disabled'
```
2012-09-29 15:42:43 +01:00
Pedro Algarvio
b0017f0e5a Make sure the tests logging handler catches all messages when active. 2012-09-27 11:39:26 +01:00
Pedro Algarvio
7339cd6950 Allow clearing the stored log messages. 2012-09-15 15:28:09 +01:00
Pedro Algarvio
b20b05cb41 Add a tests logging handler. Refs #1986.
This is just a simple logging handler which will keep all emitted log messages in a list. This can be used to test if a certain log messages is emitted in a certain scenario. Usage example:

```python
with TestsLoggingHandler() as handler:
    # (...)               Do what ever you wish here
    handler.messages    # here are the emitted log messages
```
2012-09-15 15:27:47 +01:00
Jeff Schroeder
94ec7d4816 Make an error go to stderr and remove net 1 LOC 2012-06-30 14:53:32 -07:00
David Boucha
7e7d831103 Disable find unit tests on Windows
There are problems with pwd, grp and /dev/null
as they don't exist on Windows. So we are disabling
tests that use those for now.
2012-06-24 19:43:43 -06:00
Baiju Muthukadan
24bb4ea4e0 Fix PEP8 warnings for test cases 2012-05-29 22:10:20 +05:30
Thomas S Hatch
b7870955e2 cleanly add paths 2012-04-27 15:40:55 -06:00
Monty Taylor
c9950cc571 Clean up code for 3.2 2012-04-20 13:20:51 -07:00
Eivind Uggedal
ab7ace6aa5 Split out integration tests from pure unit tests.
Integration tests requiring a salt master and daemon were seperated
from pure unit tests. For now both are run with runtest.py. In
the future it could take arguments for which type of tests to run.
2012-02-20 13:18:13 +01:00
Eivind Uggedal
099470ab37 Terminate master and minion processes after tests are finished. 2012-02-20 00:07:38 +01:00
Thomas S Hatch
30c692bf2d add convenience functions to gather config options
This commit adds 2 functions to the ModuleCase class allowing for easier
access to the configuration data
2012-02-14 10:55:16 -07:00
Thomas S Hatch
edb689f9e0 Add path settings to saltunittest 2012-02-14 00:26:22 -07:00
Thomas S Hatch
6d57ea1d5e clean up extra prints in the test run 2012-02-12 16:36:01 -07:00
Thomas S Hatch
fd82c47a95 more refinements to unittesting 2012-02-12 16:03:31 -07:00
Thomas S Hatch
07b4320a89 Initial push towards active unit testing
After a great deal of thought, I feel that the only way to reliably run
a test suite it to start a minion and master, and condition the data to
reflect the literal returns (take out the transport overhead).

This commit is the initial push towards this method of unit testing,
these test will be able to acctually test every aspect of salt.
2012-02-12 01:24:20 -07:00
Evan Borgstrom
11cc43d22d Now that it's working let's make it a little nicer to use [GH-522]
This allows for tests to be written without too much change from the
normal unittest workflow. Now they should use the 'saltunittest'
namespace and we will need to import anything we need from the original
'unittest' or 'unittest2' namespace.
2012-01-29 10:17:51 -05:00