resolving Issue #3824 - expanding docs
This commit is contained in:
		
							parent
							
								
									2137e2b15b
								
							
						
					
					
						commit
						a12eadd9ef
					
				
							
								
								
									
										1
									
								
								AUTHORS
								
								
								
								
							
							
						
						
									
										1
									
								
								AUTHORS
								
								
								
								
							|  | @ -98,6 +98,7 @@ Javier Domingo Cansino | ||||||
| Javier Romero | Javier Romero | ||||||
| Jeff Rackauckas | Jeff Rackauckas | ||||||
| Jeff Widman | Jeff Widman | ||||||
|  | Jenni Rinker | ||||||
| John Eddie Ayson | John Eddie Ayson | ||||||
| John Towler | John Towler | ||||||
| Jon Sonesen | Jon Sonesen | ||||||
|  |  | ||||||
|  | @ -0,0 +1 @@ | ||||||
|  | Added example for multiple glob pattern matches in ``python_files``. | ||||||
|  | @ -100,8 +100,10 @@ Changing naming conventions | ||||||
| 
 | 
 | ||||||
| You can configure different naming conventions by setting | You can configure different naming conventions by setting | ||||||
| the :confval:`python_files`, :confval:`python_classes` and | the :confval:`python_files`, :confval:`python_classes` and | ||||||
| :confval:`python_functions` configuration options.  Example:: | :confval:`python_functions` configuration options. | ||||||
|  | Here is an example:: | ||||||
| 
 | 
 | ||||||
|  |     # Example 1: have pytest look for "check" instead of "test" | ||||||
|     # content of pytest.ini |     # content of pytest.ini | ||||||
|     # can also be defined in tox.ini or setup.cfg file, although the section |     # can also be defined in tox.ini or setup.cfg file, although the section | ||||||
|     # name in setup.cfg files should be "tool:pytest" |     # name in setup.cfg files should be "tool:pytest" | ||||||
|  | @ -112,7 +114,7 @@ the :confval:`python_files`, :confval:`python_classes` and | ||||||
| 
 | 
 | ||||||
| This would make ``pytest`` look for tests in files that match the ``check_* | This would make ``pytest`` look for tests in files that match the ``check_* | ||||||
| .py`` glob-pattern, ``Check`` prefixes in classes, and functions and methods | .py`` glob-pattern, ``Check`` prefixes in classes, and functions and methods | ||||||
| that match ``*_check``.  For example, if we have:: | that match ``*_check``. For example, if we have:: | ||||||
| 
 | 
 | ||||||
|     # content of check_myapp.py |     # content of check_myapp.py | ||||||
|     class CheckMyApp(object): |     class CheckMyApp(object): | ||||||
|  | @ -121,7 +123,7 @@ that match ``*_check``.  For example, if we have:: | ||||||
|         def complex_check(self): |         def complex_check(self): | ||||||
|             pass |             pass | ||||||
| 
 | 
 | ||||||
| then the test collection looks like this:: | The test collection would look like this:: | ||||||
| 
 | 
 | ||||||
|     $ pytest --collect-only |     $ pytest --collect-only | ||||||
|     =========================== test session starts ============================ |     =========================== test session starts ============================ | ||||||
|  | @ -136,6 +138,14 @@ then the test collection looks like this:: | ||||||
| 
 | 
 | ||||||
|     ======================= no tests ran in 0.12 seconds ======================= |     ======================= no tests ran in 0.12 seconds ======================= | ||||||
| 
 | 
 | ||||||
|  | You can check for multiple glob patterns by adding a space between the patterns:: | ||||||
|  | 
 | ||||||
|  |     # Example 2: have pytest look for files with "test" and "example" | ||||||
|  |     # content of pytest.ini, tox.ini, or setup.cfg file (replace "pytest" | ||||||
|  |     # with "tool:pytest" for setup.cfg) | ||||||
|  |     [pytest] | ||||||
|  |     python_files=test_*.py example_*.py | ||||||
|  | 
 | ||||||
| .. note:: | .. note:: | ||||||
| 
 | 
 | ||||||
|    the ``python_functions`` and ``python_classes`` options has no effect |    the ``python_functions`` and ``python_classes`` options has no effect | ||||||
|  |  | ||||||
|  | @ -1229,7 +1229,8 @@ passed multiple times. The expected format is ``name=value``. For example:: | ||||||
| .. confval:: python_classes | .. confval:: python_classes | ||||||
| 
 | 
 | ||||||
|    One or more name prefixes or glob-style patterns determining which classes |    One or more name prefixes or glob-style patterns determining which classes | ||||||
|    are considered for test collection. By default, pytest will consider any |    are considered for test collection. Search for multiple glob patterns by | ||||||
|  |    adding a space between patterns. By default, pytest will consider any | ||||||
|    class prefixed with ``Test`` as a test collection.  Here is an example of how |    class prefixed with ``Test`` as a test collection.  Here is an example of how | ||||||
|    to collect tests from classes that end in ``Suite``: |    to collect tests from classes that end in ``Suite``: | ||||||
| 
 | 
 | ||||||
|  | @ -1246,15 +1247,23 @@ passed multiple times. The expected format is ``name=value``. For example:: | ||||||
| .. confval:: python_files | .. confval:: python_files | ||||||
| 
 | 
 | ||||||
|    One or more Glob-style file patterns determining which python files |    One or more Glob-style file patterns determining which python files | ||||||
|    are considered as test modules. By default, pytest will consider |    are considered as test modules. Search for multiple glob patterns by | ||||||
|    any file matching with ``test_*.py`` and ``*_test.py`` globs as a test |    adding a space between patterns:: | ||||||
|    module. | 
 | ||||||
|  |    .. code-block:: ini | ||||||
|  | 
 | ||||||
|  |         [pytest] | ||||||
|  |         python_files = test_*.py check_*.py example_*.py | ||||||
|  | 
 | ||||||
|  |    By default, pytest will consider any file matching with ``test_*.py``  | ||||||
|  |    and ``*_test.py`` globs as a test module. | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| .. confval:: python_functions | .. confval:: python_functions | ||||||
| 
 | 
 | ||||||
|    One or more name prefixes or glob-patterns determining which test functions |    One or more name prefixes or glob-patterns determining which test functions | ||||||
|    and methods are considered tests. By default, pytest will consider any |    and methods are considered tests. Search for multiple glob patterns by | ||||||
|  |    adding a space between patterns. By default, pytest will consider any | ||||||
|    function prefixed with ``test`` as a test.  Here is an example of how |    function prefixed with ``test`` as a test.  Here is an example of how | ||||||
|    to collect test functions and methods that end in ``_test``: |    to collect test functions and methods that end in ``_test``: | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue