Small documentation improvements
This commit is contained in:
		
							parent
							
								
									0dd1c8bf14
								
							
						
					
					
						commit
						20f97c3041
					
				|  | @ -116,10 +116,11 @@ | ||||||
|   Example '-o xfail_strict=True'. A complete ini-options can be viewed |   Example '-o xfail_strict=True'. A complete ini-options can be viewed | ||||||
|   by py.test --help. Thanks `@blueyed`_ and `@fengxx`_ for the PR |   by py.test --help. Thanks `@blueyed`_ and `@fengxx`_ for the PR | ||||||
| 
 | 
 | ||||||
| * New scope for fixtures: ``"invocation"``. This fixtures may be requested by fixtures from | * Experimentally introduce new ``"invocation"`` fixture scope. At invocation scope a | ||||||
|   any scope, when they assume the same scope as the fixture requesting it. An ``invocation``-scoped |   fixture function is cached in the same way as the fixture or test function that requests it. | ||||||
|   fixture can be requested from different scopes in the same test session, |   You can now use the builtin ``monkeypatch`` fixture from ``session``-scoped fixtures | ||||||
|   in which case each scope will have its own copy. This feature is considered experimental. |   where previously you would get an error that you can not use a ``function``-scoped fixture from a | ||||||
|  |   ``session``-scoped one.* | ||||||
|   Thanks `@nicoddemus`_ for the PR. |   Thanks `@nicoddemus`_ for the PR. | ||||||
| 
 | 
 | ||||||
| * | * | ||||||
|  |  | ||||||
|  | @ -1074,9 +1074,7 @@ class FixtureManager: | ||||||
|                 assert not name.startswith(self._argprefix), name |                 assert not name.startswith(self._argprefix), name | ||||||
| 
 | 
 | ||||||
|             def new_fixture_def(name, scope): |             def new_fixture_def(name, scope): | ||||||
|                 """ |                 """Create and registers a new FixtureDef with given name and scope.""" | ||||||
|                 Creates and registers a new FixtureDef with given name and scope. |  | ||||||
|                 """ |  | ||||||
|                 fixture_def = FixtureDef(self, nodeid, name, obj, |                 fixture_def = FixtureDef(self, nodeid, name, obj, | ||||||
|                                          scope, marker.params, |                                          scope, marker.params, | ||||||
|                                          unittest=unittest, ids=marker.ids) |                                          unittest=unittest, ids=marker.ids) | ||||||
|  | @ -1126,7 +1124,7 @@ class FixtureManager: | ||||||
|     def getfixturedefs_multiple_scopes(self, argname, nodeid): |     def getfixturedefs_multiple_scopes(self, argname, nodeid): | ||||||
|         """ |         """ | ||||||
|         Gets multiple scoped fixtures which are applicable to the given nodeid. Multiple scoped |         Gets multiple scoped fixtures which are applicable to the given nodeid. Multiple scoped | ||||||
|         fixtures are usually created by "invocation" scoped fixtures and have argnames in |         fixtures are created by "invocation" scoped fixtures and have argnames in | ||||||
|         the form: "<argname>:<scope>" (for example "tmpdir:session"). |         the form: "<argname>:<scope>" (for example "tmpdir:session"). | ||||||
| 
 | 
 | ||||||
|         :return: dict of "argname" -> [FixtureDef]. |         :return: dict of "argname" -> [FixtureDef]. | ||||||
|  |  | ||||||
|  | @ -37,6 +37,11 @@ value and can manage processes which will live for the duration of the scope. | ||||||
| 
 | 
 | ||||||
|     @pytest.fixture(scope='invocation') |     @pytest.fixture(scope='invocation') | ||||||
|     def process_manager(): |     def process_manager(): | ||||||
|  |         """ | ||||||
|  |         Return a ProcessManager instance which can be used to start | ||||||
|  |         long-lived processes and ensures they are terminated at the | ||||||
|  |         appropriate scope. | ||||||
|  |         """ | ||||||
|         m = ProcessManager() |         m = ProcessManager() | ||||||
|         yield m |         yield m | ||||||
|         m.shutdown_all() |         m.shutdown_all() | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue