Changeset 729:0e295374422f in hatta-dev


Ignore:
Timestamp:
01/21/10 17:53:17 (2 years ago)
Author:
sheep@…
Branch:
default
Message:

comment the test_repo tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/test_repo.py

    r635 r729  
    11#!/usr/bin/python 
    22# -*- coding: utf-8 -*- 
     3 
     4""" 
     5This is a set of unit tests for testing the repository storage of Hatta wiki 
     6engine. To run it, run py.test (at least version 1.0) from the main Hatta 
     7directory. 
     8""" 
    39 
    410import os 
     
    1016 
    1117def clear_directory(top): 
     18    """ 
     19    A helper function to remove a directory with all its contents. 
     20    """ 
     21 
    1222    for root, dirs, files in os.walk(top, topdown=False): 
    1323        for name in files: 
     
    2131 
    2232def pytest_funcarg__repo(request): 
     33    """ 
     34    This function is executed whenever a test needs a "repo" parameter. 
     35    It creates a new WikiStorage object with Hatta repository in a 
     36    temporary directory. 
     37    """ 
     38 
    2339    repo_path = str(request.config.ensuretemp('repo')) 
    2440    request.addfinalizer(lambda: clear_directory(repo_path)) 
     
    2642 
    2743class TestMercurialStorage(object): 
     44    """ 
     45    This class groups the general tests for Hatta storage that should 
     46    always pass, no matter what configuration is used. 
     47    """ 
     48 
    2849    def test_save_text(self, repo): 
     50        """ 
     51        Create a page and read its contents, verify that it matches. 
     52        """ 
     53 
    2954        text = u"test text" 
    3055        title = u"test title" 
     
    3661 
    3762    def test_save_text_noparent(self, repo): 
     63        """ 
     64        Save a page with parent set to None. 
     65        """ 
     66 
    3867        text = u"test text" 
    3968        title = u"test title" 
     
    4574 
    4675    def test_save_merge_no_conflict(self, repo): 
     76        """ 
     77        Create a page two times, with the same content. Verify that 
     78        it is merged correctly. 
     79        """ 
     80 
    4781        text = u"test\ntext" 
    4882        title = u"test title" 
     
    5589 
    5690    def test_save_merge_line_conflict(self, repo): 
    57         text = u"123\n456\n789" 
    58         text1 = u"123\n000\n789" 
    59         text2 = u"123\n111\n789" 
     91        """ 
     92        Modify a page twice, saving conflicting content. Verify that merge 
     93        markers are inserted properly. 
     94        """ 
     95 
     96        text = u"""\ 
     97123 
     98456 
     99789""" 
     100        text1 = u"""\ 
     101123 
     102000 
     103789""" 
     104        text2 = u"""\ 
     105123 
     106111 
     107789""" 
    60108        title = u"test title" 
    61109        author = u"test author" 
     
    65113        repo.save_text(title, text2, author, comment, parent=0) 
    66114        saved = repo.open_page(title).read() 
    67         assert saved == "123\n<<<<<<< local\n111\n=======\n000\n>>>>>>> other\n789" 
     115        assert saved == u"""\ 
     116123 
     117<<<<<<< local 
     118111 
     119======= 
     120000 
     121>>>>>>> other 
     122789""" 
    68123 
    69124    def test_delete(self, repo): 
     125        """ 
     126        Create and delete a page. 
     127        """ 
     128 
    70129        text = u"text test" 
    71130        title = u"test title" 
Note: See TracChangeset for help on using the changeset viewer.