mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-31 07:04:12 +00:00 
			
		
		
		
	#1248: Reuse Docker images in functional tests
This commit is contained in:
		
							
								
								
									
										6
									
								
								tests/functional/conftest.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								tests/functional/conftest.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| import pytest | ||||
|  | ||||
|  | ||||
| @pytest.fixture(autouse=True) | ||||
| def build_container_mock(mocker): | ||||
|     return mocker.patch('pytest_docker_pexpect.docker.build_container') | ||||
| @@ -4,12 +4,12 @@ from tests.functional.plots import with_confirmation, without_confirmation, \ | ||||
|     select_command_with_arrows, how_to_configure | ||||
|  | ||||
|  | ||||
| python_3 = (u'thefuck/python3-bash', | ||||
|             u'FROM python:3', | ||||
| python_3 = (u'thefuck/python3', | ||||
|             u'', | ||||
|             u'sh') | ||||
|  | ||||
| python_2 = (u'thefuck/python2-bash', | ||||
|             u'FROM python:2', | ||||
| python_2 = (u'thefuck/python2', | ||||
|             u'', | ||||
|             u'sh') | ||||
|  | ||||
|  | ||||
| @@ -28,8 +28,6 @@ echo "instant mode ready: $THEFUCK_INSTANT_MODE" | ||||
| def proc(request, spawnu, TIMEOUT): | ||||
|     container, instant_mode = request.param | ||||
|     proc = spawnu(*container) | ||||
|     proc.sendline(u"pip install /src") | ||||
|     assert proc.expect([TIMEOUT, u'Successfully installed']) | ||||
|     proc.sendline(init_bashrc.format( | ||||
|         u'--enable-experimental-instant-mode' if instant_mode else '')) | ||||
|     proc.sendline(u"bash") | ||||
|   | ||||
| @@ -2,29 +2,13 @@ import pytest | ||||
| from tests.functional.plots import with_confirmation, without_confirmation, \ | ||||
|     refuse_with_confirmation, select_command_with_arrows | ||||
|  | ||||
| containers = (('thefuck/python3-fish', | ||||
|                u'''FROM python:3 | ||||
|                    # Use jessie-backports since it has the fish package. See here for details: | ||||
|                    # https://github.com/tianon/docker-brew-debian/blob/88ae21052affd8a14553bb969f9d41c464032122/jessie/backports/Dockerfile | ||||
|                    RUN awk '$1 ~ "^deb" { $3 = $3 "-backports"; print; exit }' /etc/apt/sources.list > /etc/apt/sources.list.d/backports.list | ||||
|                    RUN apt-get update | ||||
|                    RUN apt-get install -yy fish''', | ||||
|                u'fish'), | ||||
|               ('thefuck/python2-fish', | ||||
|                u'''FROM python:2 | ||||
|                    # Use jessie-backports since it has the fish package. See here for details: | ||||
|                    # https://github.com/tianon/docker-brew-debian/blob/88ae21052affd8a14553bb969f9d41c464032122/jessie/backports/Dockerfile | ||||
|                    RUN awk '$1 ~ "^deb" { $3 = $3 "-backports"; print; exit }' /etc/apt/sources.list > /etc/apt/sources.list.d/backports.list | ||||
|                    RUN apt-get update | ||||
|                    RUN apt-get install -yy fish''', | ||||
|                u'fish')) | ||||
| containers = ((u'thefuck/python3', u'', u'fish'), | ||||
|               (u'thefuck/python2', u'', u'fish')) | ||||
|  | ||||
|  | ||||
| @pytest.fixture(params=containers) | ||||
| def proc(request, spawnu, TIMEOUT): | ||||
|     proc = spawnu(*request.param) | ||||
|     proc.sendline(u"pip install /src") | ||||
|     assert proc.expect([TIMEOUT, u'Successfully installed']) | ||||
|     proc.sendline(u'thefuck --alias > ~/.config/fish/config.fish') | ||||
|     proc.sendline(u'fish') | ||||
|     return proc | ||||
|   | ||||
| @@ -2,23 +2,13 @@ import pytest | ||||
| from tests.functional.plots import with_confirmation, without_confirmation, \ | ||||
|     refuse_with_confirmation, select_command_with_arrows | ||||
|  | ||||
| containers = (('thefuck/python3-tcsh', | ||||
|                u'''FROM python:3 | ||||
|                    RUN apt-get update | ||||
|                    RUN apt-get install -yy tcsh''', | ||||
|                u'tcsh'), | ||||
|               ('thefuck/python2-tcsh', | ||||
|                u'''FROM python:2 | ||||
|                    RUN apt-get update | ||||
|                    RUN apt-get install -yy tcsh''', | ||||
|                u'tcsh')) | ||||
| containers = ((u'thefuck/python3', u'', u'tcsh'), | ||||
|               (u'thefuck/python2', u'', u'tcsh')) | ||||
|  | ||||
|  | ||||
| @pytest.fixture(params=containers) | ||||
| def proc(request, spawnu, TIMEOUT): | ||||
|     proc = spawnu(*request.param) | ||||
|     proc.sendline(u'pip install /src') | ||||
|     assert proc.expect([TIMEOUT, u'Successfully installed']) | ||||
|     proc.sendline(u'tcsh') | ||||
|     proc.sendline(u'setenv PYTHONIOENCODING utf8') | ||||
|     proc.sendline(u'eval `thefuck --alias`') | ||||
|   | ||||
| @@ -4,17 +4,8 @@ from tests.functional.plots import with_confirmation, without_confirmation, \ | ||||
|     select_command_with_arrows, how_to_configure | ||||
|  | ||||
|  | ||||
| python_3 = ('thefuck/python3-zsh', | ||||
|             u'''FROM python:3 | ||||
|                 RUN apt-get update | ||||
|                 RUN apt-get install -yy zsh''', | ||||
|             u'sh') | ||||
|  | ||||
| python_2 = ('thefuck/python2-zsh', | ||||
|             u'''FROM python:2 | ||||
|                 RUN apt-get update | ||||
|                 RUN apt-get install -yy zsh''', | ||||
|             u'sh') | ||||
| python_3 = (u'thefuck/python3', u'', u'sh') | ||||
| python_2 = (u'thefuck/python2', u'', u'sh') | ||||
|  | ||||
|  | ||||
| init_zshrc = u'''echo ' | ||||
| @@ -35,8 +26,6 @@ echo "instant mode ready: $THEFUCK_INSTANT_MODE" | ||||
| def proc(request, spawnu, TIMEOUT): | ||||
|     container, instant_mode = request.param | ||||
|     proc = spawnu(*container) | ||||
|     proc.sendline(u'pip install /src') | ||||
|     assert proc.expect([TIMEOUT, u'Successfully installed']) | ||||
|     proc.sendline(init_zshrc.format( | ||||
|         u'--enable-experimental-instant-mode' if instant_mode else '')) | ||||
|     proc.sendline(u"zsh") | ||||
|   | ||||
		Reference in New Issue
	
	Block a user