Commits

Fredrik Håård committed 4ef9ea6

Removed bloat from example
Why would the example demo os and shutil?

Comments (0)

Files changed (2)

 configlist) just as in the internal Mercurial API.
 
 Example usage::
-    >>> import hgapi, shutil, os
-    >>> os.mkdir("./test_hgapi")
-    >>> repo = hgapi.Repo("test_hgapi")
+    >>> import hgapi
+    >>> repo = hgapi.Repo("test_hgapi") #existing folder
     >>> repo.hg_init()
-    >>> with open("test_hgapi/file.txt", "w") as target:
-    ...  w = target.write("stuff")
-    >>> repo.hg_add("file.txt")
+    >>> repo.hg_add("file.txt") #already created but not added file
     >>> repo.hg_commit("Adding file.txt", user="me")
     >>> str(repo['tip'].desc)
     'Adding file.txt'
-    >>> shutil.rmtree("test_hgapi")
 
 Installation
 ============

hgapi/testhgapi.py

         self.assertEquals(self.repo["tip"].desc, "}")
         self.assertEquals(self.repo["tip"].author, "},desc=\"test")
   
+def test_doc():
+    os.mkdir("./test_hgapi")
+    with open("test_hgapi/file.txt", "w") as target:
+        w = target.write("stuff")
+    res = doctest.testfile("../README.rst")
+    shutil.rmtree("test_hgapi")
 
 if __name__ == "__main__":
-    res = doctest.testfile("../README.rst")
+    test_doc()
     unittest.main()