Allow spaces in -p arguments (#10658)
This commit is contained in:
		
							parent
							
								
									bd7919e03d
								
							
						
					
					
						commit
						af4143729f
					
				
							
								
								
									
										1
									
								
								AUTHORS
								
								
								
								
							
							
						
						
									
										1
									
								
								AUTHORS
								
								
								
								
							|  | @ -378,6 +378,7 @@ Wouter van Ackooy | ||||||
| Xixi Zhao | Xixi Zhao | ||||||
| Xuan Luong | Xuan Luong | ||||||
| Xuecong Liao | Xuecong Liao | ||||||
|  | Yannick Péroux | ||||||
| Yoav Caspi | Yoav Caspi | ||||||
| Yuliang Shao | Yuliang Shao | ||||||
| Yusuke Kadowaki | Yusuke Kadowaki | ||||||
|  |  | ||||||
|  | @ -0,0 +1,3 @@ | ||||||
|  | Allow ``-p`` arguments to include spaces (eg: ``-p no:logging`` instead of | ||||||
|  | ``-pno:logging``). Mostly useful in the ``addopts`` section of the configuration | ||||||
|  | file. | ||||||
|  | @ -697,6 +697,7 @@ class PytestPluginManager(PluginManager): | ||||||
|                     parg = opt[2:] |                     parg = opt[2:] | ||||||
|                 else: |                 else: | ||||||
|                     continue |                     continue | ||||||
|  |                 parg = parg.strip() | ||||||
|                 if exclude_only and not parg.startswith("no:"): |                 if exclude_only and not parg.startswith("no:"): | ||||||
|                     continue |                     continue | ||||||
|                 self.consider_pluginarg(parg) |                 self.consider_pluginarg(parg) | ||||||
|  |  | ||||||
|  | @ -1808,6 +1808,10 @@ def test_config_does_not_load_blocked_plugin_from_args(pytester: Pytester) -> No | ||||||
|     result.stderr.fnmatch_lines(["*: error: unrecognized arguments: -s"]) |     result.stderr.fnmatch_lines(["*: error: unrecognized arguments: -s"]) | ||||||
|     assert result.ret == ExitCode.USAGE_ERROR |     assert result.ret == ExitCode.USAGE_ERROR | ||||||
| 
 | 
 | ||||||
|  |     result = pytester.runpytest(str(p), "-p no:capture", "-s") | ||||||
|  |     result.stderr.fnmatch_lines(["*: error: unrecognized arguments: -s"]) | ||||||
|  |     assert result.ret == ExitCode.USAGE_ERROR | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| def test_invocation_args(pytester: Pytester) -> None: | def test_invocation_args(pytester: Pytester) -> None: | ||||||
|     """Ensure that Config.invocation_* arguments are correctly defined""" |     """Ensure that Config.invocation_* arguments are correctly defined""" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue