Source

pytest-patches / regendoc-pytesthighlight

# HG changeset patch
# Parent 5c030fad0636dd42ad3ab7bc4968c57d3b0049e1
use codeblocks with pytest syntax to get reasonable coloring

diff --git a/doc/assert.txt b/doc/assert.txt
--- a/doc/assert.txt
+++ b/doc/assert.txt
@@ -19,7 +19,9 @@ following::
         assert f() == 4
 
 to assert that your function returns a certain value. If this assertion fails
-you will see the return value of the function call::
+you will see the return value of the function call:
+
+.. code-block:: pytest
 
     $ py.test test_assert1.py
     =========================== test session starts ============================
@@ -101,7 +103,9 @@ when it encounters comparisons.  For exa
         set2 = set("8035")
         assert set1 == set2
 
-if you run this module::
+if you run this module:
+
+.. code-block:: pytest
 
     $ py.test test_assert2.py
     =========================== test session starts ============================
@@ -165,7 +169,9 @@ now, given this test module::
        assert f1 == f2
 
 you can run the test module and get the custom output defined in 
-the conftest file::
+the conftest file:
+
+.. code-block:: pytest
 
    $ py.test -q test_foocompare.py
    collecting ... collected 1 items
diff --git a/doc/builtin.txt b/doc/builtin.txt
--- a/doc/builtin.txt
+++ b/doc/builtin.txt
@@ -24,7 +24,9 @@ Builtin function arguments
 -----------------------------------------------------
 
 You can ask for available builtin or project-custom
-:ref:`function arguments <funcargs>` by typing::
+:ref:`function arguments <funcargs>` by typing:
+
+.. code-block:: pytest
 
     $ py.test --funcargs
     =========================== test session starts ============================
diff --git a/doc/capture.txt b/doc/capture.txt
--- a/doc/capture.txt
+++ b/doc/capture.txt
@@ -60,7 +60,9 @@ is that you can use print statements for
         assert False
 
 and running this module will show you precisely the output
-of the failing function and hide the other one::
+of the failing function and hide the other one:
+
+.. code-block:: pytest
 
     $ py.test
     =========================== test session starts ============================
diff --git a/doc/doctest.txt b/doc/doctest.txt
--- a/doc/doctest.txt
+++ b/doc/doctest.txt
@@ -40,7 +40,9 @@ and another like this::
         """
         return 42
 
-then you can just invoke ``py.test`` without command line options::
+then you can just invoke ``py.test`` without command line options:
+
+.. code-block:: pytest
 
     $ py.test
     =========================== test session starts ============================
diff --git a/doc/funcargs.txt b/doc/funcargs.txt
--- a/doc/funcargs.txt
+++ b/doc/funcargs.txt
@@ -58,7 +58,9 @@ This test function needs an injected obj
 py.test will discover and call the factory named
 ``pytest_funcarg__myfuncarg`` within the same module in this case.
 
-Running the test looks like this::
+Running the test looks like this:
+
+.. code-block:: pytest
 
     $ py.test test_simplefactory.py
     =========================== test session starts ============================
@@ -163,7 +165,9 @@ hook to generate several calls to the sa
     def test_func(numiter):
         assert numiter < 9
 
-Running this will generate ten invocations of ``test_func`` passing in each of the items in the list of ``range(10)``::
+Running this will generate ten invocations of ``test_func`` passing in each of the items in the list of ``range(10)``:
+
+.. code-block:: pytest
 
     $ py.test test_example.py
     =========================== test session starts ============================
@@ -186,7 +190,9 @@ Running this will generate ten invocatio
 
 Obviously, only when ``numiter`` has the value of ``9`` does the test fail.  Note that the ``pytest_generate_tests(metafunc)`` hook is called during
 the test collection phase which is separate from the actual test running.
-Let's just look at what is collected::
+Let's just look at what is collected:
+
+.. code-bloc:: pytest
 
     $ py.test --collectonly test_example.py
     =========================== test session starts ============================
@@ -206,7 +212,9 @@ Let's just look at what is collected::
     
     =============================  in 0.01 seconds =============================
 
-If you want to select only the run with the value ``7`` you could do::
+If you want to select only the run with the value ``7`` you could do:
+
+.. code-block:: pytest
 
     $ py.test -v -k 7 test_example.py  # or -k test_func[7]
     =========================== test session starts ============================
diff --git a/doc/getting-started.txt b/doc/getting-started.txt
--- a/doc/getting-started.txt
+++ b/doc/getting-started.txt
@@ -42,7 +42,9 @@ Let's create a first test file with a si
     def test_answer():
         assert func(3) == 5
 
-That's it. You can execute the test function now::
+That's it. You can execute the test function now:
+
+.. code-block:: pytest
 
     $ py.test
     =========================== test session starts ============================
@@ -90,7 +92,9 @@ use the ``raises`` helper::
         with pytest.raises(SystemExit):
             f()
 
-Running it with, this time in "quiet" reporting mode::
+Running it with, this time in "quiet" reporting mode:
+
+.. code-block:: pytest
 
     $ py.test -q test_sysexit.py
     collecting ... collected 1 items
@@ -118,7 +122,9 @@ containing two tests::
 
 The two tests are found because of the standard :ref:`test discovery`.
 There is no need to subclass anything.  We can simply
-run the module by passing its filename::
+run the module by passing its filename:
+
+.. code-block:: pytest
 
     $ py.test -q test_class.py
     collecting ... collected 2 items
@@ -155,7 +161,9 @@ arbitrary resources, for example a uniqu
 
 We list the name ``tmpdir`` in the test function signature and
 py.test will lookup and call a factory to create the resource
-before performing the test function call.  Let's just run it::
+before performing the test function call.  Let's just run it:
+
+.. code-block:: pytest
 
     $ py.test -q test_tmpdir.py
     collecting ... collected 1 items
diff --git a/doc/tmpdir.txt b/doc/tmpdir.txt
--- a/doc/tmpdir.txt
+++ b/doc/tmpdir.txt
@@ -24,7 +24,9 @@ and more.  Here is an example test usage
         assert 0
 
 Running this would result in a passed test except for the last
-``assert 0`` line which we use to look at values::
+``assert 0`` line which we use to look at values:
+
+.. code-block:: pytest
 
     $ py.test test_tmpdir.py
     =========================== test session starts ============================
diff --git a/doc/unittest.txt b/doc/unittest.txt
--- a/doc/unittest.txt
+++ b/doc/unittest.txt
@@ -20,7 +20,9 @@ of treating tests such as IO capturing::
             x = 1
             self.assertEquals(x, 3)
        
-Running it yields::
+Running it yields:
+
+.. code-block:: pytest
 
     $ py.test test_unittest.py
     =========================== test session starts ============================