| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1a77f1b commit 6753406
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -112,7 +112,7 @@ test suite runs. | |||
| 112 | 112 | ||
| 113 | 113 | A simple doctest in a function: | |
| 114 | 114 | ||
| 115 | - :: | ||
| 115 | + .. code-block:: python | ||
| 116 | 116 | ||
| 117 | 117 | def square(x): | |
| 118 | 118 | """Squares x. | |
@@ -142,15 +142,15 @@ py.test | |||
| 142 | 142 | ||
| 143 | 143 | py.test is a no-boilerplate alternative to Python's standard unittest module. | |
| 144 | 144 | ||
| 145 | - :: | ||
| 145 | + .. code-block:: console | ||
| 146 | 146 | ||
| 147 | 147 | $ pip install pytest | |
| 148 | 148 | ||
| 149 | 149 | Despite being a fully-featured and extensible test tool, it boasts a simple | |
| 150 | 150 | syntax. Creating a test suite is as easy as writing a module with a couple of | |
| 151 | 151 | functions | |
| 152 | 152 | ||
| 153 | - :: | ||
| 153 | + .. code-block:: console | ||
| 154 | 154 | ||
| 155 | 155 | # content of test_sample.py | |
| 156 | 156 | def func(x): | |
@@ -161,7 +161,7 @@ functions | |||
| 161 | 161 | ||
| 162 | 162 | and then running the `py.test` command | |
| 163 | 163 | ||
| 164 | - :: | ||
| 164 | + .. code-block:: console | ||
| 165 | 165 | ||
| 166 | 166 | $ py.test | |
| 167 | 167 | =========================== test session starts ============================ | |
@@ -193,7 +193,7 @@ Nose | |||
| 193 | 193 | nose extends unittest to make testing easier. | |
| 194 | 194 | ||
| 195 | 195 | ||
| 196 | - :: | ||
| 196 | + .. code-block:: console | ||
| 197 | 197 | ||
| 198 | 198 | $ pip install nose | |
| 199 | 199 | ||
@@ -210,7 +210,7 @@ tox | |||
| 210 | 210 | tox is a tool for automating test environment management and testing against | |
| 211 | 211 | multiple interpreter configurations | |
| 212 | 212 | ||
| 213 | - :: | ||
| 213 | + .. code-block:: console | ||
| 214 | 214 | ||
| 215 | 215 | $ pip install tox | |
| 216 | 216 | ||
@@ -227,14 +227,14 @@ API and better assertions over the one available in previous versions of Python. | |||
| 227 | 227 | ||
| 228 | 228 | If you're using Python 2.6 or below, you can install it with pip | |
| 229 | 229 | ||
| 230 | - :: | ||
| 230 | + .. code-block:: console | ||
| 231 | 231 | ||
| 232 | 232 | $ pip install unittest2 | |
| 233 | 233 | ||
| 234 | 234 | You may want to import the module under the name unittest to make porting code | |
| 235 | 235 | to newer versions of the module easier in the future | |
| 236 | 236 | ||
| 237 | - :: | ||
| 237 | + .. code-block:: python | ||
| 238 | 238 | ||
| 239 | 239 | import unittest2 as unittest | |
| 240 | 240 | ||
@@ -253,7 +253,7 @@ mock | |||
| 253 | 253 | ||
| 254 | 254 | mock is a library for testing in Python. | |
| 255 | 255 | ||
| 256 | - :: | ||
| 256 | + .. code-block:: console | ||
| 257 | 257 | ||
| 258 | 258 | $ pip install mock | |
| 259 | 259 | ||
@@ -262,7 +262,7 @@ make assertions about how they have been used. | |||
| 262 | 262 | ||
| 263 | 263 | For example, you can monkey patch a method | |
| 264 | 264 | ||
| 265 | - :: | ||
| 265 | + .. code-block:: console | ||
| 266 | 266 | ||
| 267 | 267 | from mock import MagicMock | |
| 268 | 268 | thing = ProductionClass() | |
@@ -275,7 +275,7 @@ To mock classes or objects in a module under test, use the ``patch`` decorator. | |||
| 275 | 275 | In the example below, an external search system is replaced with a mock that | |
| 276 | 276 | always returns the same result (but only for the duration of the test). | |
| 277 | 277 | ||
| 278 | - :: | ||
| 278 | + .. code-block:: console | ||
| 279 | 279 | ||
| 280 | 280 | def mock_search(self): | |
| 281 | 281 | class MockSearchQuerySet(SearchQuerySet): | |
| Back | FazBrowse Home | New Git URL |
0 commit comments