archlinuxcn / lilac

Lilac is the build bot for archlinuxcn
GNU General Public License v3.0
114 stars 40 forks source link

lilaclib: fix update_pkgrel() for pkgrel >= 10 and add tests #64

Closed yan12125 closed 6 years ago

yan12125 commented 6 years ago

For example, a PKGBUILD with pkgrel=10 should become pkgrel=11 after calling update_pkgrel().

The test suite uses pytest. A sample run:

$ py.test-3.6 -v
===================================================== test session starts ======================================================
platform darwin -- Python 3.6.5, pytest-3.5.1, py-1.5.3, pluggy-0.6.0 -- /opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6
cachedir: .pytest_cache
rootdir: /Users/yen/Projects/lilac, inifile:
collected 5 items

test/test_lilaclib.py::test_update_pkgrel[pkgrel=1-pkgrel=2-kwargs0] PASSED                                              [ 20%]
test/test_lilaclib.py::test_update_pkgrel[pkgrel=10-pkgrel=11-kwargs1] PASSED                                            [ 40%]
test/test_lilaclib.py::test_update_pkgrel[pkgrel=1.1-pkgrel=2-kwargs2] PASSED                                            [ 60%]
test/test_lilaclib.py::test_update_pkgrel[pkgrel="1"-pkgrel=2-kwargs3] PASSED                                            [ 80%]
test/test_lilaclib.py::test_update_pkgrel[pkgrel=1-pkgrel=3-kwargs4] PASSED                                              [100%]

=================================================== 5 passed in 0.22 seconds ===================================================
yan12125 commented 6 years ago

Fixed whitespacing - 'pkgbuild,expected_pkgbuild, kwargs' => 'pkgbuild, expected_pkgbuild, kwargs'

lilydjwg commented 6 years ago

Thanks!