def test_syu(self): """ test upgrade of repo and AUR packages """ self.downgrade_repo1_pkg() self.downgrade_aur1_pkg() query_result = pikaur('-Quq --aur').stdout self.assertEqual(query_result.splitlines(), [self.aur_pkg_name]) query_result = pikaur('-Quq --repo').stdout self.assertEqual(query_result.splitlines(), [self.repo_pkg_name]) query_result = pikaur('-Qu').stdout self.assertEqual(len(query_result.splitlines()), 2) self.assertIn(self.aur_pkg_name, query_result) self.assertIn(self.repo_pkg_name, query_result) # and finally test the sysupgrade itself pikaur('-Su --noconfirm') self.assertNotEqual( PackageDB.get_local_dict()[self.repo_pkg_name].version, self.repo_old_version) self.assertNotEqual( PackageDB.get_local_dict()[self.aur_pkg_name].version, self.aur_old_version)
def test_aur_package_with_aur_dep(self): # aur package with aur dep and custom makepkg flags pikaur('-S pacaur-no-ud --mflags=--skippgpcheck') self.assertInstalled('pacaur-no-ud') self.assertInstalled('cower') # package removal (pacman wrapping test) pikaur('-Rs pacaur-no-ud cower --noconfirm') self.assertNotInstalled('pacaur-no-ud') self.assertNotInstalled('cower') pikaur('-S cower-git --mflags=--skippgpcheck') self.assertInstalled('cower-git') # aur package with aur dep provided by another already installed AUR pkg pikaur('-S pacaur-no-ud') self.assertInstalled('pacaur-no-ud') self.assertProvidedBy('cower', 'cower-git') self.remove_packages('pacaur-no-ud', 'cower-git') # aur package with manually chosen aur dep: pikaur('-S pacaur-no-ud cower-git') self.assertInstalled('pacaur-no-ud') self.assertProvidedBy('cower', 'cower-git')
def test_syu_aur_repo_flags(self): """ test --aur and --repo flags with sysupgrade """ self.downgrade_repo1_pkg() self.downgrade_aur1_pkg() pikaur('-Su --noconfirm --repo') self.assertNotEqual( PackageDB.get_local_dict()[self.repo_pkg_name].version, self.repo_old_version ) self.assertEqual( PackageDB.get_local_dict()[self.aur_pkg_name].version, self.aur_old_version ) self.downgrade_repo1_pkg() pikaur('-Su --noconfirm --aur') self.assertEqual( PackageDB.get_local_dict()[self.repo_pkg_name].version, self.repo_old_version ) self.assertNotEqual( PackageDB.get_local_dict()[self.aur_pkg_name].version, self.aur_old_version )
def test_split_packages_2(self): # Split packages 2: libc++ fake_pikaur('-S libc++ --mflags=--skippgpcheck,--noextract') self.assertInstalled('libc++') # Split packages 2: libc++abi (installing already built package) pikaur('-S libc++abi') self.assertInstalled('libc++abi')
def test_pkgbuild(self): pkg_name = 'pikaur-git' pikaur(f'-R --noconfirm {pkg_name}') self.assertNotInstalled(pkg_name) pikaur('-P ./PKGBUILD --noconfirm --install') self.assertInstalled(pkg_name)
def test_search_multiword(self): result_first = pikaur('-Ssq aur').stdout.splitlines() result_second = pikaur('-Ssq helper').stdout.splitlines() result_all = pikaur('-Ssq aur helper').stdout.splitlines() self.assertIn('pikaur', result_all) self.assertGreaterEqual(len(result_all), 10) self.assertEqual(set(result_all), set(result_first).intersection(result_second))
def test_splitted_pkg_with_base_deps(self): """ when split packages have base depends section those deps should be installed during the build see #320 """ pikaur('-S python-magic-wormhole') self.assertInstalled('python-magic-wormhole') self.assertNotInstalled('python2-txtorcon')
def test_cache_full_clean(self): from pikaur.config import BUILD_CACHE_PATH, PACKAGE_CACHE_PATH pikaur('-S inxi --rebuild --keepbuild') self.assertGreaterEqual(len(os.listdir(BUILD_CACHE_PATH)), 1) self.assertGreaterEqual(len(os.listdir(PACKAGE_CACHE_PATH)), 1) pikaur('-Scc --noconfirm') self.assertFalse(os.path.exists(BUILD_CACHE_PATH)) self.assertFalse(os.path.exists(PACKAGE_CACHE_PATH))
def test_cache_clean(self): # pylint:disable=import-outside-toplevel from pikaur.config import BUILD_CACHE_PATH, PACKAGE_CACHE_PATH pikaur('-S inxi --rebuild --keepbuild') self.assertGreaterEqual(len(os.listdir(BUILD_CACHE_PATH)), 1) self.assertGreaterEqual(len(os.listdir(PACKAGE_CACHE_PATH)), 1) pikaur('-Sc --noconfirm') self.assertFalse(os.path.exists(BUILD_CACHE_PATH)) self.assertGreaterEqual(len(os.listdir(PACKAGE_CACHE_PATH)), 1)
def test_split_packages_3(self): # Split packages 3: 1 split package pikaur('-S python-pyalsaaudio') self.assertInstalled('python-pyalsaaudio') self.assertNotInstalled('python2-pyalsaaudio') self.remove_packages('python-pyalsaaudio') # Split packages 3: 2 split packages pikaur('-S python2-pyalsaaudio python-pyalsaaudio') self.assertInstalled('python2-pyalsaaudio') self.assertInstalled('python-pyalsaaudio')
def test_splitted_pkg_with_base_deps(self): """ when split packages have base depends section those deps should be installed during the build see #320 """ self.remove_if_installed('python2-twisted', 'python-twisted') pikaur('-S python-txtorcon') self.assertInstalled('python-txtorcon') self.assertInstalled('python-twisted') self.assertNotInstalled('python2-twisted')
def test_aur_package_with_alternative_aur_dep(self): pkg_name = 'dwm' dep_name = 'st' dep_alt_name = 'st-git' self.remove_if_installed(pkg_name, dep_name, dep_alt_name) # aur package with manually chosen aur dep: pikaur(f'-S {pkg_name} {dep_alt_name}') self.assertInstalled(pkg_name) self.assertProvidedBy(dep_name, dep_alt_name) self.assertInstalled(dep_alt_name) self.assertNotInstalled(dep_name)
def test_pkgbuild_split_packages(self): pkg_base = 'python-pyalsaaudio' pkg_name1 = pkg_base pkg_name2 = 'python2-pyalsaaudio' self.remove_if_installed(pkg_name1) self.remove_if_installed(pkg_name2) pikaur(f'-G {pkg_base}') pikaur(f'-P ./{pkg_base}/PKGBUILD --noconfirm --install') self.assertInstalled(pkg_name1) self.assertInstalled(pkg_name2)
def test_list(self): result_all = pikaur('-Ssq').stdout.splitlines() result_aur = pikaur('-Ssq --aur').stdout.splitlines() result_repo = pikaur('-Ssq --repo').stdout.splitlines() self.assertIn('oomox-git', result_all) self.assertIn('oomox-git', result_aur) self.assertNotIn('oomox-git', result_repo) self.assertIn('pacman', result_all) self.assertNotIn('pacman', result_aur) self.assertIn('pacman', result_repo) self.assertGreaterEqual(len(result_aur), 50000) self.assertGreaterEqual(len(result_repo), 100) self.assertEqual(len(result_all), len(result_aur) + len(result_repo))
def test_aur_package_with_aur_dep(self): # pikaur -Qi (pikaur -Qdmq) | grep -i -e Name -e 'Required By' -e '^$' pkg_name = 'python-gaphor' dep_name = 'python-generic' self.remove_if_installed(pkg_name, dep_name) pikaur(f'-S {pkg_name} --mflags=--skippgpcheck') self.assertInstalled(pkg_name) self.assertInstalled(dep_name) # package removal (pacman wrapping test) pikaur(f'-Rs {pkg_name} {dep_name} --noconfirm') self.assertNotInstalled(pkg_name) self.assertNotInstalled(dep_name)
def test_aur_pkg_with_already_installed_alternative_aur_dep(self): pkg_name = 'dwm' dep_name = 'st' dep_alt_name = 'st-git' self.remove_if_installed(pkg_name, dep_name, dep_alt_name) pikaur(f'-S {dep_alt_name} --mflags=--skippgpcheck') self.assertInstalled(dep_alt_name) self.assertProvidedBy(dep_name, dep_alt_name) self.assertInstalled(dep_alt_name) self.assertNotInstalled(dep_name) # aur package with aur dep provided by another already installed AUR pkg pikaur(f'-S {pkg_name}') self.assertInstalled(pkg_name)
def test_devel_upgrade(self): """ test upgrade of AUR dev package """ self.downgrade_dev_pkg() self.assertEqual(self.upgradeable_pkgs_list, []) # and finally test the sysupgrade itself pikaur('-Su --noconfirm --devel --ignore pikaur-git') # pikaur(f'-S {self.dev_pkg_name} --noconfirm --devel') self.assertNotEqual( PackageDB.get_local_dict()[self.dev_pkg_name].version, self.dev_old_version)
def test_aur_package_with_aur_dep(self): pkg_name = 'pacaur' dep_name = 'auracle-git' dep2_name = 'expac' dep2_alt_name = 'expac-git' self.remove_if_installed(pkg_name, dep_name, dep2_name, dep2_alt_name) pikaur(f'-S {pkg_name} --mflags=--skippgpcheck') self.assertInstalled(pkg_name) self.assertInstalled(dep_name) # package removal (pacman wrapping test) pikaur(f'-Rs {pkg_name} {dep_name} {dep2_name} --noconfirm') self.assertNotInstalled(pkg_name) self.assertNotInstalled(dep_name) self.assertNotInstalled(dep2_name)
def test_devel_upgrade(self): """ test upgrade of AUR dev package """ self.downgrade_dev_pkg() query_result = pikaur('-Qu').stdout self.assertEqual(len(query_result.splitlines()), 0) # and finally test the sysupgrade itself pikaur('-Su --noconfirm --devel --ignore pikaur-git') # pikaur(f'-S {self.dev_pkg_name} --noconfirm --devel') self.assertNotEqual( PackageDB.get_local_dict()[self.dev_pkg_name].version, self.dev_old_version)
def test_aur_package_info(self): result = pikaur('-Si oomox') pkg_name_found = False for line in result.stdout.splitlines(): if 'name' in line.lower() and 'oomox' in line: pkg_name_found = True self.assertTrue(pkg_name_found)
def test_sy_only(self): """ When running pikaur -Sy to only update the database indexes, Pikaur continues to load the databases off disk if they were updated (if you have a slow rotating HDD and many packages, it can take some time) then exits with "Nothing to do". (pacman just exits). see #339 """ pikaur('-Syu') result_syu = pikaur('-Syu', capture_stdout=True) self.assertIn("nothing to do", result_syu.stdout.lower()) result_sy = pikaur('-Sy', capture_stdout=True) self.assertNotIn("nothing to do", result_sy.stdout.lower())
def test_search_multiword_too_many(self): """ https://github.com/actionless/pikaur/issues/298 """ proc_aur_too_many = pikaur('-Ssq --aur python', capture_stderr=True) self.assertIn("Too many package results for 'python'", proc_aur_too_many.stderr) result_aur_too_many = proc_aur_too_many.stdout.splitlines() self.assertEqual(len(result_aur_too_many), 0) result_aur_second = pikaur('-Ssq --aur opencv').stdout.splitlines() self.assertIn('python-imutils', result_aur_second) self.assertIn('opencv-git', result_aur_second) result_all = pikaur('-Ssq --aur python opencv').stdout.splitlines() self.assertIn('python-imutils', result_all) self.assertNotIn('opencv-git', result_all)
def test_getpkgbuild_group_package(self): result = pikaur('-G gnome', capture_stderr=True) self.assertEqual( result.returncode, 0 ) self.assertIn( 'cannot be found', result.stderr )
def test_install_not_found(self): """ package can't be found in AUR """ not_existing_pkg_name = "not-existing-aur-package-7h68712683h1628h1" result = pikaur(f'-S {not_existing_pkg_name}', capture_stderr=True) self.assertEqual(result.returncode, 6) self.assertEqual(result.stderr.splitlines()[-1].strip(), not_existing_pkg_name)
def downgrade_dev_pkg(self): # test -P <custom_name> and -G -d during downgrading self.remove_if_installed(self.dev_pkg_name) spawn(f'rm -fr ./{self.dev_pkg_name}') pikaur(f'-G -d {self.dev_pkg_name}') dev_pkg_url = self.dev_pkg_url.replace('/', r'\/') spawn([ "bash", "-c", f"cd ./{self.dev_pkg_name}/ && " "sed -e 's/" "^source=.*" "/" f'source=("git+{dev_pkg_url}#branch=master~1")' "/' PKGBUILD > PKGBUILD_prev" ]) pikaur(f'-P -i --noconfirm ./{self.dev_pkg_name}/PKGBUILD_prev') self.assertInstalled(self.dev_pkg_name) self.dev_old_version = PackageDB.get_local_dict()[ self.dev_pkg_name].version
def test_version_mismatch_repo(self): """ dependency repo package version not satisfied """ pkg_name = "pikaur-test-version-mismatch-repo" result = pikaur(f'-Pi ./pikaur_test/PKGBUILD_version_mismatch_repo', capture_stderr=True) self.assertEqual(result.returncode, 131) self.assertIn(MSG_VERSION_MISMATCH, result.stderr) self.assertIn(pkg_name, result.stderr) self.assertNotInstalled(pkg_name)
def test_sy_only(self): """ When running pikaur -Sy to only update the database indexes, Pikaur continues to load the databases off disk if they were updated (if you have a slow rotating HDD and many packages, it can take some time) then exits with "Nothing to do". (pacman just exits). see #339 """ output = "" attempts = 0 while ("nothing to do" not in output) and (attempts < 5): result_syu = pikaur('-Syu --ignore pikaur-git', capture_stdout=True) output = result_syu.stdout.lower() attempts += 1 self.assertIn("nothing to do", output) result_sy = pikaur('-Sy', capture_stdout=True) self.assertNotIn("nothing to do", result_sy.stdout.lower())
def test_syu(self): """ test upgrade of repo and AUR packages """ self.downgrade_repo1_pkg() self.downgrade_aur1_pkg() self.assertEqual(self.upgradeable_aur_pkgs_list, [self.aur_pkg_name]) self.assertEqual(self.upgradeable_repo_pkgs_list, [self.repo_pkg_name]) self.assertEqual(list(sorted(self.upgradeable_pkgs_list)), list(sorted([self.repo_pkg_name, self.aur_pkg_name]))) # and finally test the sysupgrade itself pikaur('-Su --noconfirm') self.assertNotEqual( PackageDB.get_local_dict()[self.repo_pkg_name].version, self.repo_old_version) self.assertNotEqual( PackageDB.get_local_dict()[self.aur_pkg_name].version, self.aur_old_version)
def test_dep_not_found(self): """ dependency package can't be found in AUR """ pkg_name = "pikaur-test-not-found-dep" not_existing_dep_name = "not-existing-package-y8r73ruue99y5u77t5u4r" result = pikaur(f'-Pi ./pikaur_test/PKGBUILD_not_found_dep', capture_stderr=True) self.assertEqual(result.returncode, 131) self.assertIn(MSG_DEPS_MISSING, result.stderr) self.assertIn(pkg_name, result.stderr) self.assertIn(MSG_CANNOT_BE_FOUND, result.stderr) self.assertEqual(result.stderr.splitlines()[-1].strip(), not_existing_dep_name) self.assertNotInstalled(pkg_name)
def test_repo_package_with_deps(self): # repo package with deps pikaur('-S flac') self.assertInstalled('flac')