Add test case for `importorskip` custom reason
This commit is contained in:
		
							parent
							
								
									8b48621687
								
							
						
					
					
						commit
						be7eb22e88
					
				|  | @ -738,6 +738,22 @@ def test_importorskip_module_level(testdir): | ||||||
|     result.stdout.fnmatch_lines(["*collected 0 items / 1 skipped*"]) |     result.stdout.fnmatch_lines(["*collected 0 items / 1 skipped*"]) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | def test_importorskip_custom_reason(testdir): | ||||||
|  |     """make sure custom reasons are used""" | ||||||
|  |     testdir.makepyfile( | ||||||
|  |         """ | ||||||
|  |         import pytest | ||||||
|  |         foobarbaz = pytest.importorskip("foobarbaz2", reason="just because") | ||||||
|  | 
 | ||||||
|  |         def test_foo(): | ||||||
|  |             pass | ||||||
|  |     """ | ||||||
|  |     ) | ||||||
|  |     result = testdir.runpytest("-ra") | ||||||
|  |     result.stdout.fnmatch_lines(["*just because*"]) | ||||||
|  |     result.stdout.fnmatch_lines(["*collected 0 items / 1 skipped*"]) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| def test_pytest_cmdline_main(testdir): | def test_pytest_cmdline_main(testdir): | ||||||
|     p = testdir.makepyfile( |     p = testdir.makepyfile( | ||||||
|         """ |         """ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue