Mikhail Korobov  committed ee00433

Some extra docs on testing; tests are finally divided into fast and slow.

  • Participants
  • Parent commits a85f3e5
  • Branches default

Comments (0)

Files changed (3)

File docs/CHANGES.rst

 - OS is now auto-detected;
-- Ubuntu 10.10 maverick initial support;
+- Ubuntu 10.10 maverick initial support (need better testing);
 - `fabtest <>`_ package is extracted
   from the test suite;
-- more tests.
+- more and better tests;
+- :func:`fab_deploy.system.ssh_add_key` can now add ssh key even
+  if is is the first key for user
 0.4.2 (2011-02-16)

File docs/testing.rst

-django-fab-deploy requires `fabtest`_ package for running tests and
-(optionally) ```` for test coverage reports::
+django-fab-deploy requires latest `fabtest`_ package for running tests and
+(optionally) ``_ for test coverage reports::
     pip install -U fabtest
     pip install coverage
 .. _VirtualBox:
 .. _fabtest:
 Running tests
     cd fab_deploy_tests
     ./ <VM name or uid> <what to run>
-<what to run> can be `fast`, `all` or any value acceptable by
+<what to run> can be ``fast``, ``slow`` or any value acceptable by
 ``unittest.main()`` (e.g. a list of test cases).
+Some tests require additional prepared snapshots in order to greatly speedup
+test execution. But there is a chicken or the egg dilemma: these
+snapshots can be only taken if software works fine for the VM (at least
+tests are passed). So tests are divided into 'slow' and 'fast' suites.
+1. make sure slow tests are passing::
+       ./ "VM_NAME" slow
+2. prepare snapshots::
+       ./preparevm "VM_NAME"
+3. faster tests can be run now::
+       ./ "VM_NAME" fast
+Coverage reports
 In order to get coverage reports run::
     cd fab_deploy_tests

File fab_deploy_tests/

 import sys
 import os.path
 import unittest
+from unittest import TestSuite, TestLoader
 from fab_deploy_tests.tests import *
 # always use fab_deploy from the checkout, not the installed version
 path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
 sys.path.insert(0, path)
-def get_suite(cases):
-    suites = map(unittest.TestLoader().loadTestsFromTestCase, cases)
-    return unittest.TestSuite(suites)
+def load(cases):
+    return map(TestLoader().loadTestsFromTestCase, cases)
 def help():
     print 'usage: "VM_NAME" <what_to_run>\n'
     FabDeployTest.vm_name = sys.argv[1]
+    common_tests = load([BasicTest, SshTest, MysqlTest])
     suites = {
-        'fast': get_suite([BasicTest, SshTest, FastPrepareServerTest, MysqlTest]),
-        'slow': get_suite([PrepareServerTest])
+        'fast': TestSuite(common_tests + load([FastPrepareServerTest])),
+        'slow': TestSuite(common_tests + load([PrepareServerTest])),
-    suites['all'] = unittest.TestSuite(suites.values())
     suite_name = sys.argv[2]
     if suite_name in suites: