| OLD | NEW |
| 1 # This file is part of Adblock Plus <https://adblockplus.org/>, | 1 # This file is part of Adblock Plus <https://adblockplus.org/>, |
| 2 # Copyright (C) 2006-present eyeo GmbH | 2 # Copyright (C) 2006-present eyeo GmbH |
| 3 # | 3 # |
| 4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
| 5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
| 6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
| 7 # | 7 # |
| 8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 def test_convert(patch_data): | 58 def test_convert(patch_data): |
| 59 got = list(patchconv.rietveld_to_git(patch_data['input'])) | 59 got = list(patchconv.rietveld_to_git(patch_data['input'])) |
| 60 print('GOT') | 60 print('GOT') |
| 61 for line in got: | 61 for line in got: |
| 62 print(' ' + line, end='') | 62 print(' ' + line, end='') |
| 63 assert got == patch_data['expect'] | 63 assert got == patch_data['expect'] |
| 64 | 64 |
| 65 | 65 |
| 66 def test_script(): | 66 def test_script(): |
| 67 process = subprocess.Popen( | 67 process = subprocess.Popen( |
| 68 ['patchconv'], stdin=subprocess.PIPE, stdout=subprocess.PIPE | 68 ['patchconv'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, |
| 69 ) | 69 ) |
| 70 in_patch = '''Index: README.txt | 70 in_patch = '''Index: README.txt |
| 71 =================================================================== | 71 =================================================================== |
| 72 --- a/README.txt | 72 --- a/README.txt |
| 73 ''' | 73 ''' |
| 74 expect = '''diff --git a/README.txt b/README.txt | 74 expect = '''diff --git a/README.txt b/README.txt |
| 75 --- a/README.txt | 75 --- a/README.txt |
| 76 ''' | 76 ''' |
| 77 out, err = process.communicate(input=in_patch.encode('ascii')) | 77 out, err = process.communicate(input=in_patch.encode('ascii')) |
| 78 assert out == expect.encode('ascii') | 78 assert out == expect.encode('ascii') |
| 79 | 79 |
| 80 stdin = StringIO(in_patch) | 80 stdin = StringIO(in_patch) |
| 81 stdout = StringIO() | 81 stdout = StringIO() |
| 82 with mock.patch('sys.stdin', stdin), mock.patch('sys.stdout', stdout): | 82 with mock.patch('sys.stdin', stdin), mock.patch('sys.stdout', stdout): |
| 83 patchconv.main() | 83 patchconv.main() |
| 84 assert stdout.getvalue() == expect | 84 assert stdout.getvalue() == expect |
| OLD | NEW |