Dylan Baker | 8607944 | 2019-09-25 14:56:21 -0700 | [diff] [blame] | 1 | # Copyright © 2019 Intel Corporation |
| 2 | |
| 3 | # Permission is hereby granted, free of charge, to any person obtaining a copy |
| 4 | # of this software and associated documentation files (the "Software"), to deal |
| 5 | # in the Software without restriction, including without limitation the rights |
| 6 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 7 | # copies of the Software, and to permit persons to whom the Software is |
| 8 | # furnished to do so, subject to the following conditions: |
| 9 | |
| 10 | # The above copyright notice and this permission notice shall be included in |
| 11 | # all copies or substantial portions of the Software. |
| 12 | |
| 13 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 19 | # SOFTWARE. |
| 20 | |
Dylan Baker | 8607944 | 2019-09-25 14:56:21 -0700 | [diff] [blame] | 21 | import pytest |
| 22 | |
| 23 | from .gen_release_notes import * |
| 24 | |
| 25 | |
| 26 | @pytest.mark.parametrize( |
| 27 | 'current, is_point, expected', |
| 28 | [ |
| 29 | ('19.2.0', True, '19.2.1'), |
| 30 | ('19.3.6', True, '19.3.7'), |
| 31 | ('20.0.0-rc4', False, '20.0.0'), |
| 32 | ]) |
| 33 | def test_next_version(current: str, is_point: bool, expected: str) -> None: |
| 34 | assert calculate_next_version(current, is_point) == expected |
| 35 | |
| 36 | |
| 37 | @pytest.mark.parametrize( |
| 38 | 'current, is_point, expected', |
| 39 | [ |
| 40 | ('19.3.6', True, '19.3.6'), |
| 41 | ('20.0.0-rc4', False, '19.3.0'), |
| 42 | ]) |
| 43 | def test_previous_version(current: str, is_point: bool, expected: str) -> None: |
| 44 | assert calculate_previous_version(current, is_point) == expected |
| 45 | |
| 46 | |
| 47 | @pytest.mark.asyncio |
| 48 | async def test_get_shortlog(): |
| 49 | # Certainly not perfect, but it's something |
| 50 | version = '19.2.0' |
| 51 | out = await get_shortlog(version) |
| 52 | assert out |
| 53 | |
| 54 | |
| 55 | @pytest.mark.asyncio |
| 56 | async def test_gather_commits(): |
| 57 | # Certainly not perfect, but it's something |
| 58 | version = '19.2.0' |
| 59 | out = await gather_commits(version) |
| 60 | assert out |