mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-30 14:44:05 +00:00 
			
		
		
		
	#N/A: Add prove_recursively rule
				
					
				
			This commit is contained in:
		
							
								
								
									
										40
									
								
								tests/rules/test_prove_recursively.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								tests/rules/test_prove_recursively.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | ||||
| import pytest | ||||
| from thefuck.rules.prove_recursively import match, get_new_command | ||||
| from thefuck.types import Command | ||||
|  | ||||
|  | ||||
| output = '''Files=0, Tests=0,  0 wallclock secs ( 0.00 usr +  0.00 sys =  0.00 CPU) | ||||
| Result: NOTESTS''' | ||||
|  | ||||
|  | ||||
| @pytest.fixture | ||||
| def isdir(mocker): | ||||
|     return mocker.patch('thefuck.rules.prove_recursively' | ||||
|                         '.os.path.isdir') | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize('script, output', [ | ||||
|     ('prove -lv t', output), | ||||
|     ('prove app/t', output)]) | ||||
| def test_match(isdir, script, output): | ||||
|     isdir.return_value = True | ||||
|     command = Command(script, output) | ||||
|     assert match(command) | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize('script, output, isdir_result', [ | ||||
|     ('prove -lv t', output, False), | ||||
|     ('prove -r t', output, True), | ||||
|     ('prove --recurse t', output, True)]) | ||||
| def test_not_match(isdir, script, output, isdir_result): | ||||
|     isdir.return_value = isdir_result | ||||
|     command = Command(script, output) | ||||
|     assert not match(command) | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize('before, after', [ | ||||
|     ('prove -lv t', 'prove -r -lv t'), | ||||
|     ('prove t', 'prove -r t')]) | ||||
| def test_get_new_command(before, after): | ||||
|     command = Command(before, output) | ||||
|     assert get_new_command(command) == after | ||||
		Reference in New Issue
	
	Block a user