aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2022-10-16 20:27:36 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2022-10-16 20:27:36 +0300
commit729947acaa9bb071936c4d68fa1dfe86628f2d26 (patch)
tree5d81042e15c7b2e3b84544fe89c853638be628d4 /tests
parentdoc: fix generating of code when built in PEP517 mode (diff)
downloadpkgdev-729947acaa9bb071936c4d68fa1dfe86628f2d26.tar.gz
pkgdev-729947acaa9bb071936c4d68fa1dfe86628f2d26.tar.bz2
pkgdev-729947acaa9bb071936c4d68fa1dfe86628f2d26.zip
commit: don't show disable for targets that are no-op
For PYTHON_COMPAT, LUA_COMPAT and USE_RUBY, show the "disable" target after "enable" only if this target exists. For example, if I enable py3.11 and disable py3.7 (which is no-op), it will show only "enable py3.11". If there is no "enable", it will still show "disable py3.7". Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/scripts/test_pkgdev_commit.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/scripts/test_pkgdev_commit.py b/tests/scripts/test_pkgdev_commit.py
index f920054..efc9491 100644
--- a/tests/scripts/test_pkgdev_commit.py
+++ b/tests/scripts/test_pkgdev_commit.py
@@ -479,6 +479,9 @@ class TestPkgdevCommit:
assert commit() == 'cat/pkg: update DESCRIPTION, HOMEPAGE'
# update string_targets (USE_RUBY)
+ os.mkdir(pjoin(repo.location, 'profiles', 'desc'))
+ with open(pjoin(repo.path, 'profiles', 'desc', 'ruby_targets.desc'), 'w') as file:
+ file.write('\n'.join(f'ruby{ver} - stub' for ver in range(27, 40)))
repo.create_ebuild('cat/pkg-8', use_ruby='ruby27')
git_repo.add_all('cat/pkg-8')
repo.create_ebuild('cat/pkg-8', use_ruby='ruby27 ruby30')
@@ -489,12 +492,16 @@ class TestPkgdevCommit:
assert commit() == 'cat/pkg: update USE_RUBY support'
# update array_targets (PYTHON_COMPAT)
- repo.create_ebuild('cat/pkg-9', data='PYTHON_COMPAT=( python3_9 )')
+ with open(pjoin(repo.path, 'profiles', 'desc', 'python_targets.desc'), 'w') as file:
+ file.write('\n'.join(f'python3_{ver} - stub' for ver in (10, 11)))
+ repo.create_ebuild('cat/pkg-9', data='PYTHON_COMPAT=( python3_8 python3_9 )')
git_repo.add_all('cat/pkg-9')
- repo.create_ebuild('cat/pkg-9', data='PYTHON_COMPAT=( python3_{9..10} )')
+ repo.create_ebuild('cat/pkg-9', data='PYTHON_COMPAT=( python3_{8..10} )')
assert commit() == 'cat/pkg: enable py3.10'
- repo.create_ebuild('cat/pkg-9', data='PYTHON_COMPAT=( python3_10 )')
- assert commit() == 'cat/pkg: disable py3.9'
+ repo.create_ebuild('cat/pkg-9', data='PYTHON_COMPAT=( python3_{9..10} )')
+ assert commit() == 'cat/pkg: disable py3.8'
+ repo.create_ebuild('cat/pkg-9', data='PYTHON_COMPAT=( python3_{10..11} )')
+ assert commit() == 'cat/pkg: enable py3.11'
# multiple ebuild modifications don't get a generated summary
@@ -508,12 +515,12 @@ class TestPkgdevCommit:
assert commit() == 'cat/pkg: add versions'
# create Manifest
- with open(pjoin(git_repo.path, 'cat/pkg/Manifest'), 'w') as f:
- f.write('DIST pkg-3.tar.gz 101 BLAKE2B deadbeef SHA512 deadbeef\n')
+ with open(pjoin(git_repo.path, 'cat/pkg/Manifest'), 'w') as file:
+ file.write('DIST pkg-3.tar.gz 101 BLAKE2B deadbeef SHA512 deadbeef\n')
assert commit() == 'cat/pkg: update Manifest'
# update Manifest
- with open(pjoin(git_repo.path, 'cat/pkg/Manifest'), 'a+') as f:
- f.write('DIST pkg-2.tar.gz 101 BLAKE2B deadbeef SHA512 deadbeef\n')
+ with open(pjoin(git_repo.path, 'cat/pkg/Manifest'), 'a+') as file:
+ file.write('DIST pkg-2.tar.gz 101 BLAKE2B deadbeef SHA512 deadbeef\n')
assert commit() == 'cat/pkg: update Manifest'
# remove Manifest
os.remove(pjoin(git_repo.path, 'cat/pkg/Manifest'))