[svn r64028] use pygments for syntax-coloring python code and console

--HG--
branch : trunk
This commit is contained in:
hpk
2009-04-13 14:54:58 +02:00
parent 58c4366fb9
commit 0324f84a78
2 changed files with 63 additions and 8 deletions

View File

@@ -20,7 +20,9 @@ of course all the functionality is bundled together rather than spread over a
number of modules.
Example usage, here we use the :api:`py.test.ensuretemp()` function to create
a :api:`py.path.local` object for us (which wraps a directory)::
a :api:`py.path.local` object for us (which wraps a directory):
.. sourcecode:: pycon
>>> import py
>>> temppath = py.test.ensuretemp('py.path_documentation')
@@ -46,7 +48,9 @@ Both allow you to access relatively advanced features such as metadata and
versioning, and both in a way more user-friendly manner than existing other
solutions.
Some example usage of :api:`py.path.svnurl`::
Some example usage of :api:`py.path.svnurl`:
.. sourcecode:: pycon
.. >>> import py
.. >>> if not py.test.config.option.urlcheck: raise ValueError('skipchunk')
@@ -59,7 +63,9 @@ Some example usage of :api:`py.path.svnurl`::
>>> time.strftime('%Y-%m-%d', time.gmtime(firstentry.date))
'2004-10-02'
Example usage of :api:`py.path.svnwc`::
Example usage of :api:`py.path.svnwc`:
.. sourcecode:: pycon
.. >>> if not py.test.config.option.urlcheck: raise ValueError('skipchunk')
>>> temp = py.test.ensuretemp('py.path_documentation')
@@ -98,7 +104,7 @@ Searching `.txt` files
Search for a particular string inside all files with a .txt extension in a
specific directory.
::
.. sourcecode:: pycon
>>> dirpath = temppath.ensure('testdir', dir=True)
>>> dirpath.join('textfile1.txt').write('foo bar baz')
@@ -120,7 +126,9 @@ Working with Paths
This example shows the :api:`py.path` features to deal with
filesystem paths Note that the filesystem is never touched,
all operations are performed on a string level (so the paths
don't have to exist, either)::
don't have to exist, either):
.. sourcecode:: pycon
>>> p1 = py.path.local('/foo/bar')
>>> p2 = p1.join('baz/qux')
@@ -153,7 +161,9 @@ Checking path types
.......................
Now we will show a bit about the powerful 'check()' method on paths, which
allows you to check whether a file exists, what type it is, etc.::
allows you to check whether a file exists, what type it is, etc.:
.. sourcecode:: pycon
>>> file1 = temppath.join('file1')
>>> file1.check() # does it exist?
@@ -177,7 +187,9 @@ Setting svn-properties
.......................
As an example of 'uncommon' methods, we'll show how to read and write
properties in an :api:`py.path.svnwc` instance::
properties in an :api:`py.path.svnwc` instance:
.. sourcecode:: pycon
.. >>> if not py.test.config.option.urlcheck: raise ValueError('skipchunk')
>>> wc.propget('foo')
@@ -195,7 +207,9 @@ SVN authentication
.......................
Some uncommon functionality can also be provided as extensions, such as SVN
authentication::
authentication:
.. sourcecode:: pycon
.. >>> if not py.test.config.option.urlcheck: raise ValueError('skipchunk')
>>> auth = py.path.SvnAuth('anonymous', 'user', cache_auth=False,