mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 00:04:15 +02:00
M3 namespace migration: complete Phase B, partial Phase D, docs and tests
- Native runtime under bearhub/ (api, commons, gems, view/util, view/core, view/qt) - bauh/ compatibility re-export shims for legacy imports - Phase D: canonical __version__/__app_name__ in bearhub/__init__.py; pyproject.toml and setup.py point at bearhub package - Native gem loader at bearhub/view/core/gems.py - Namespace compatibility tests (159 tests passing) - Documentation: CHANGELOG [Unreleased], NAMESPACE_MIGRATION, ROADMAP, README, CONTRIBUTING, docs/qt6-migration.md, packaging/aur/README.md
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from bauh.api.abstract.model import PackageUpdate
|
||||
from bearhub.api.abstract.model import PackageUpdate
|
||||
|
||||
|
||||
class PackageUpdateTest(TestCase):
|
||||
|
||||
17
tests/api/test_namespace.py
Normal file
17
tests/api/test_namespace.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from bearhub.api.paths import CONFIG_DIR, CACHE_DIR
|
||||
from bearhub.commons.util import size_to_byte
|
||||
|
||||
|
||||
class TestApiNamespace(TestCase):
|
||||
|
||||
def test_bauh_compat_api_import(self):
|
||||
from bauh.api.paths import CONFIG_DIR as legacy_config
|
||||
|
||||
self.assertEqual(legacy_config, CONFIG_DIR)
|
||||
|
||||
def test_bauh_compat_commons_import(self):
|
||||
from bauh.commons.util import size_to_byte as legacy_size
|
||||
|
||||
self.assertEqual(legacy_size(1, 'K'), size_to_byte(1, 'K'))
|
||||
@@ -1,6 +1,6 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from bauh.commons.util import size_to_byte, sanitize_command_input
|
||||
from bearhub.commons.util import size_to_byte, sanitize_command_input
|
||||
|
||||
|
||||
class SizeToByteTest(TestCase):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import warnings
|
||||
from unittest import TestCase
|
||||
|
||||
from bauh.commons.version_util import match_required_version
|
||||
from bearhub.commons.version_util import match_required_version
|
||||
|
||||
|
||||
class MatchRequiredVersionTest(TestCase):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import locale
|
||||
from unittest import TestCase
|
||||
|
||||
from bauh.commons.view_utils import get_human_size_str
|
||||
from bearhub.commons.view_utils import get_human_size_str
|
||||
|
||||
|
||||
class GetHumanSizeStrTest(TestCase):
|
||||
|
||||
22
tests/gems/appimage/test_namespace.py
Normal file
22
tests/gems/appimage/test_namespace.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from bearhub.gems.appimage.controller import AppImageManager
|
||||
from bearhub.view.core.gems import _discover_gem_dirs, _import_controller_module
|
||||
|
||||
|
||||
class TestAppImageNamespace(TestCase):
|
||||
|
||||
def test_bauh_compat_import(self):
|
||||
from bauh.gems.appimage.util import replace_desktop_entry_exec_command
|
||||
|
||||
self.assertTrue(callable(replace_desktop_entry_exec_command))
|
||||
|
||||
def test_appimage_discovered_under_bearhub(self):
|
||||
gem_dirs = dict(_discover_gem_dirs())
|
||||
self.assertIn('appimage', gem_dirs)
|
||||
self.assertIn('bearhub/gems/appimage', gem_dirs['appimage'].replace('\\', '/'))
|
||||
|
||||
def test_controller_import_prefers_bearhub(self):
|
||||
module = _import_controller_module('appimage')
|
||||
self.assertEqual(module.__name__, 'bearhub.gems.appimage.controller')
|
||||
self.assertIs(module.AppImageManager, AppImageManager)
|
||||
@@ -1,6 +1,6 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from bauh.gems.appimage.util import replace_desktop_entry_exec_command
|
||||
from bearhub.gems.appimage.util import replace_desktop_entry_exec_command
|
||||
|
||||
|
||||
class TestUtil(TestCase):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
from unittest import TestCase
|
||||
|
||||
from bauh.gems.arch import aur
|
||||
from bearhub.gems.arch import aur
|
||||
|
||||
FILE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ import warnings
|
||||
from unittest import TestCase
|
||||
from unittest.mock import Mock
|
||||
|
||||
from bauh.gems.arch.mapper import AURDataMapper
|
||||
from bauh.gems.arch.model import ArchPackage
|
||||
from bearhub.gems.arch.mapper import AURDataMapper
|
||||
from bearhub.gems.arch.model import ArchPackage
|
||||
|
||||
|
||||
class ArchDataMapperTest(TestCase):
|
||||
|
||||
22
tests/gems/arch/test_namespace.py
Normal file
22
tests/gems/arch/test_namespace.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from bearhub.gems.arch.controller import ArchManager
|
||||
from bearhub.view.core.gems import _discover_gem_dirs, _import_controller_module
|
||||
|
||||
|
||||
class TestArchNamespace(TestCase):
|
||||
|
||||
def test_bauh_compat_import(self):
|
||||
from bearhub.gems.arch.model import ArchPackage
|
||||
|
||||
self.assertTrue(issubclass(ArchPackage, object))
|
||||
|
||||
def test_arch_discovered_under_bearhub(self):
|
||||
gem_dirs = dict(_discover_gem_dirs())
|
||||
self.assertIn('arch', gem_dirs)
|
||||
self.assertIn('bearhub/gems/arch', gem_dirs['arch'].replace('\\', '/'))
|
||||
|
||||
def test_controller_import_prefers_bearhub(self):
|
||||
module = _import_controller_module('arch')
|
||||
self.assertEqual(module.__name__, 'bearhub.gems.arch.controller')
|
||||
self.assertIs(module.ArchManager, ArchManager)
|
||||
@@ -4,7 +4,7 @@ from unittest import TestCase
|
||||
from unittest.mock import patch, Mock
|
||||
|
||||
|
||||
from bauh.gems.arch import pacman
|
||||
from bearhub.gems.arch import pacman
|
||||
|
||||
FILE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
@@ -29,7 +29,7 @@ class PacmanTest(TestCase):
|
||||
self.assertIsNotNone(ignored)
|
||||
self.assertEqual(0, len(ignored))
|
||||
|
||||
@patch("bauh.gems.arch.pacman.run_cmd", return_value="""
|
||||
@patch("bearhub.gems.arch.pacman.run_cmd", return_value="""
|
||||
Name : package-test
|
||||
Version : 3.4.4-1
|
||||
Description : Test
|
||||
@@ -42,7 +42,7 @@ Required By : None
|
||||
run_cmd.assert_called_once_with('pacman -Qi package-test')
|
||||
self.assertEqual({'package-test': {}}, res)
|
||||
|
||||
@patch("bauh.gems.arch.pacman.run_cmd", return_value="""
|
||||
@patch("bearhub.gems.arch.pacman.run_cmd", return_value="""
|
||||
Name : package-test
|
||||
Version : 3.4.4-1
|
||||
Description : Test
|
||||
@@ -55,7 +55,7 @@ Required By : None
|
||||
run_cmd.assert_called_once_with('pacman -Qi package-test')
|
||||
self.assertEqual({'package-test': {'lib32-vulkan-icd-loader': 'Vulkan support'}}, res)
|
||||
|
||||
@patch("bauh.gems.arch.pacman.run_cmd", return_value="""
|
||||
@patch("bearhub.gems.arch.pacman.run_cmd", return_value="""
|
||||
Name : package-test
|
||||
Version : 3.4.4-1
|
||||
Description : Test
|
||||
@@ -68,7 +68,7 @@ Required By : None
|
||||
run_cmd.assert_called_once_with('pacman -Qi package-test')
|
||||
self.assertEqual({'package-test': {'pipewire-alsa': ''}}, res)
|
||||
|
||||
@patch("bauh.gems.arch.pacman.run_cmd", return_value="""
|
||||
@patch("bearhub.gems.arch.pacman.run_cmd", return_value="""
|
||||
Name : package-test
|
||||
Version : 3.4.4-1
|
||||
Description : Test
|
||||
@@ -81,7 +81,7 @@ Required By : None
|
||||
run_cmd.assert_called_once_with('pacman -Qi package-test')
|
||||
self.assertEqual({'package-test': {}}, res)
|
||||
|
||||
@patch("bauh.gems.arch.pacman.run_cmd", return_value="""
|
||||
@patch("bearhub.gems.arch.pacman.run_cmd", return_value="""
|
||||
Name : package-test
|
||||
Version : 3.4.4-1
|
||||
Description : Test
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from bauh.gems.arch import sorting
|
||||
from bearhub.gems.arch import sorting
|
||||
|
||||
|
||||
class SortingTest(TestCase):
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from unittest import TestCase
|
||||
from unittest.mock import patch, Mock, MagicMock
|
||||
|
||||
from bauh.api.abstract.controller import UpgradeRequirement
|
||||
from bauh.gems.arch.dependencies import DependenciesAnalyser
|
||||
from bauh.gems.arch.model import ArchPackage
|
||||
from bauh.gems.arch.updates import UpdatesSummarizer
|
||||
from bauh.view.util.translation import I18n
|
||||
from bearhub.api.abstract.controller import UpgradeRequirement
|
||||
from bearhub.gems.arch.dependencies import DependenciesAnalyser
|
||||
from bearhub.gems.arch.model import ArchPackage
|
||||
from bearhub.gems.arch.updates import UpdatesSummarizer
|
||||
from bearhub.view.util.translation import I18n
|
||||
|
||||
|
||||
class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
@@ -27,7 +27,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
"prefer_repository_provider": True,
|
||||
"check_dependency_breakage": True}
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__should_not_return_installed_to_remove_when_conflict_with_installed_version_fails(self, pacman: Mock):
|
||||
"""
|
||||
If the newest version o package A conflicts with an installed package named B, but the conflict expression
|
||||
@@ -75,7 +75,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
self.assertFalse(res.to_install)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade)
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__should_return_installed_to_remove_when_conflict_with_installed_version_matches(self, pacman: Mock):
|
||||
"""
|
||||
If the newest version o package A conflicts with an installed package named B and the conflict expression
|
||||
@@ -129,7 +129,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
pkg_b = ArchPackage(name="B", installed=True, i18n=self.i18n)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'A'", extra_size=1)], res.to_remove)
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__should_return_installed_to_remove_when_conflict_with_installed_matches(self, pacman: Mock):
|
||||
"""
|
||||
If the newest version o package A conflicts with an installed package named B,
|
||||
@@ -183,7 +183,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
pkg_b = ArchPackage(name="B", installed=True, i18n=self.i18n)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'A'", extra_size=1)], res.to_remove)
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__should_not_return_installed_to_remove_when_conflict_with_is_self_conflict(self, pacman: Mock):
|
||||
"""
|
||||
If the newest version o package A conflicts with itself, then A should not be marked as a package to be removed.
|
||||
@@ -225,7 +225,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
self.assertFalse(res.to_install)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade)
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__should_not_return_installed_to_remove_when_conflict_with_provided_version_fails(self, pacman: Mock):
|
||||
"""
|
||||
If the newest version o package A conflicts with a provided package C (by installed package B),
|
||||
@@ -272,7 +272,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
self.assertFalse(res.to_install)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade)
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__not_return_to_remove_when_conflict_with_provided_virtual_package_with_version_fails(self, pacman: Mock):
|
||||
"""
|
||||
Scenario:
|
||||
@@ -324,7 +324,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
self.assertFalse(res.to_install)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade)
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__return_installed_virtual_with_defined_version_to_remove_when_conflict_version_matches(self, pacman: Mock):
|
||||
"""
|
||||
Scenario:
|
||||
@@ -389,7 +389,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
pkg_b = ArchPackage(name="X", installed=True, i18n=self.i18n)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'V'", extra_size=1)], res.to_remove)
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__return_installed_virtual_with_defined_version_to_remove_when_conflict_matches__case_2(self, pacman: Mock):
|
||||
"""
|
||||
This test case covers the same scenario as the above, but adds an additional provider for the same
|
||||
@@ -465,7 +465,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
pkg_b = ArchPackage(name="X", installed=True, i18n=self.i18n)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'V'", extra_size=1)], res.to_remove)
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__should_return_installed_package_to_remove_when_conflict_with_provided_matches_version(self, pacman: Mock):
|
||||
"""
|
||||
If the newest version o package A conflicts with a provided package C (by installed package B),
|
||||
@@ -522,7 +522,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
pkg_b = ArchPackage(name="B", installed=True, i18n=self.i18n)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'A'", extra_size=1)], res.to_remove)
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__should_return_installed_package_to_remove_when_conflict_with_provided_matches(self, pacman: Mock):
|
||||
"""
|
||||
If the newest version o package A conflicts with a provided package C (by installed package B),
|
||||
@@ -578,7 +578,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
pkg_b = ArchPackage(name="B", installed=True, i18n=self.i18n)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'A'", extra_size=1)], res.to_remove)
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__should_not_return_installed_to_remove_when_conflict_with_provider_is_self_conflict(self, pacman: Mock):
|
||||
"""
|
||||
If the newest version o package A conflicts with a provided package C (by A itself),
|
||||
@@ -621,7 +621,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
self.assertFalse(res.to_install)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade)
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__return_as_cannot_upgrade_when_several_to_upgrade_conflict_with_each_other(self, pacman: Mock):
|
||||
"""
|
||||
Consider package A and B are selected to be upgraded:
|
||||
@@ -681,7 +681,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
self.assertIn(UpgradeRequirement(pkg=pkg_a, reason=" 'B'"), res.cannot_upgrade)
|
||||
self.assertIn(UpgradeRequirement(pkg=pkg_b, reason=" 'A'"), res.cannot_upgrade)
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__return_as_cannot_upgrade_when_several_to_upgrade_conflict_with_provided_by_each_other(self, pacman: Mock):
|
||||
"""
|
||||
Consider package A and B are selected to be upgraded:
|
||||
@@ -743,7 +743,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
self.assertIn(UpgradeRequirement(pkg=pkg_a, reason=" 'B'"), res.cannot_upgrade)
|
||||
self.assertIn(UpgradeRequirement(pkg=pkg_b, reason=" 'A'"), res.cannot_upgrade)
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__return_as_to_remove_when_a_package_to_upgrade_conflicts_with_another(self, pacman: Mock):
|
||||
"""
|
||||
Consider package A and B are selected to be upgraded:
|
||||
@@ -805,7 +805,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'A'", extra_size=1)], res.to_remove)
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__return_as_to_remove_when_a_package_to_upgrade_conflicts_with_provided_by_another(self, pacman: Mock):
|
||||
"""
|
||||
Consider package A and B are selected to be upgraded:
|
||||
@@ -870,7 +870,7 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'A'", extra_size=1)], res.to_remove)
|
||||
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__return_as_to_remove_when_a_package_to_upgrade_conflicts_with_provided_version_by_another(self, pacman: Mock):
|
||||
"""
|
||||
Consider package A and B are selected to be upgraded:
|
||||
@@ -936,8 +936,8 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_b, reason=" 'A'", extra_size=1)], res.to_remove)
|
||||
|
||||
@patch("bauh.gems.arch.dependencies.pacman")
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.dependencies.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__return_as_cannot_upgrade_when_several_packages_to_install_conflict_with_each_other(self, *mocks: Mock):
|
||||
"""
|
||||
Consider package A and B are selected to be upgraded:
|
||||
@@ -1038,8 +1038,8 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
self.assertIn(UpgradeRequirement(pkg=pkg_a, reason="'C' 'D'"), res.cannot_upgrade)
|
||||
self.assertIn(UpgradeRequirement(pkg=pkg_b, reason="'C' 'D'"), res.cannot_upgrade)
|
||||
|
||||
@patch("bauh.gems.arch.dependencies.pacman")
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.dependencies.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__return_as_cannot_upgrade_when_packages_to_install_conflict_with_version_of_each_other(self, *mocks: Mock):
|
||||
"""
|
||||
Consider package A and B are selected to be upgraded:
|
||||
@@ -1140,8 +1140,8 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
self.assertIn(UpgradeRequirement(pkg=pkg_a, reason="'C' 'D'"), res.cannot_upgrade)
|
||||
self.assertIn(UpgradeRequirement(pkg=pkg_b, reason="'C' 'D'"), res.cannot_upgrade)
|
||||
|
||||
@patch("bauh.gems.arch.dependencies.pacman")
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.dependencies.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__return_as_to_remove_when_to_update_conflicts_with_to_install(self, *mocks: Mock):
|
||||
"""
|
||||
Consider package A and B are selected to be upgraded:
|
||||
@@ -1227,8 +1227,8 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_b, extra_size=1, reason=" 'C'")], res.to_remove)
|
||||
|
||||
@patch("bauh.gems.arch.dependencies.pacman")
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.dependencies.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__return_as_to_remove_when_to_update_conflicts_with_specific_version_of_install(self, *mocks: Mock):
|
||||
"""
|
||||
Consider package A and B are selected to be upgraded:
|
||||
@@ -1314,8 +1314,8 @@ class UpdatesSummarizerGetUpgradeRequirementsTest(TestCase):
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_a, required_size=1, extra_size=0)], res.to_upgrade)
|
||||
self.assertEqual([UpgradeRequirement(pkg=pkg_b, extra_size=1, reason=" 'C'")], res.to_remove)
|
||||
|
||||
@patch("bauh.gems.arch.dependencies.pacman")
|
||||
@patch("bauh.gems.arch.updates.pacman")
|
||||
@patch("bearhub.gems.arch.dependencies.pacman")
|
||||
@patch("bearhub.gems.arch.updates.pacman")
|
||||
def test__return_as_to_remove_when_to_update_conflicts_with_to_install_and_it_has_deps(self, *mocks: Mock):
|
||||
"""
|
||||
Consider package A and B are selected to be upgraded:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from unittest import TestCase
|
||||
from unittest.mock import Mock
|
||||
|
||||
from bauh.gems.flatpak.controller import FlatpakManager
|
||||
from bauh.gems.flatpak.model import FlatpakApplication
|
||||
from bearhub.gems.flatpak.controller import FlatpakManager
|
||||
from bearhub.gems.flatpak.model import FlatpakApplication
|
||||
|
||||
|
||||
class FlatpakManagerSortUpdateOrderTest(TestCase):
|
||||
|
||||
@@ -2,13 +2,13 @@ from unittest import TestCase
|
||||
from unittest.mock import patch, Mock
|
||||
|
||||
|
||||
from bauh.gems.flatpak import flatpak, VERSION_1_2
|
||||
from bearhub.gems.flatpak import flatpak, VERSION_1_2
|
||||
|
||||
|
||||
class FlatpakTest(TestCase):
|
||||
|
||||
@patch("bauh.gems.flatpak.flatpak.SimpleProcess")
|
||||
@patch("bauh.gems.flatpak.flatpak.ProcessHandler.handle_simple", return_value=(True, """
|
||||
@patch("bearhub.gems.flatpak.flatpak.SimpleProcess")
|
||||
@patch("bearhub.gems.flatpak.flatpak.ProcessHandler.handle_simple", return_value=(True, """
|
||||
Looking for updates...
|
||||
|
||||
\tID\tArch\tBranch\tRemote\tDownload
|
||||
|
||||
22
tests/gems/flatpak/test_namespace.py
Normal file
22
tests/gems/flatpak/test_namespace.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from bearhub.gems.flatpak.controller import FlatpakManager
|
||||
from bearhub.view.core.gems import _discover_gem_dirs, _import_controller_module
|
||||
|
||||
|
||||
class TestFlatpakNamespace(TestCase):
|
||||
|
||||
def test_bauh_compat_import(self):
|
||||
from bauh.gems.flatpak.model import FlatpakApplication
|
||||
|
||||
self.assertTrue(issubclass(FlatpakApplication, object))
|
||||
|
||||
def test_flatpak_discovered_under_bearhub(self):
|
||||
gem_dirs = dict(_discover_gem_dirs())
|
||||
self.assertIn('flatpak', gem_dirs)
|
||||
self.assertIn('bearhub/gems/flatpak', gem_dirs['flatpak'].replace('\\', '/'))
|
||||
|
||||
def test_controller_import_prefers_bearhub(self):
|
||||
module = _import_controller_module('flatpak')
|
||||
self.assertEqual(module.__name__, 'bearhub.gems.flatpak.controller')
|
||||
self.assertIs(module.FlatpakManager, FlatpakManager)
|
||||
@@ -1,6 +1,6 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from bauh.gems.flatpak.worker import FlatpakAsyncDataLoader
|
||||
from bearhub.gems.flatpak.worker import FlatpakAsyncDataLoader
|
||||
|
||||
|
||||
class FlatpakAsyncDataLoaderTest(TestCase):
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from unittest import TestCase
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from bauh.gems.web.controller import DEFAULT_LANGUAGE_HEADER
|
||||
from bauh.gems.web.controller import WebApplicationManager
|
||||
from bearhub.gems.web.controller import DEFAULT_LANGUAGE_HEADER
|
||||
from bearhub.gems.web.controller import WebApplicationManager
|
||||
|
||||
LOCALE_TARGET = 'bauh.gems.web.controller.locale.getlocale'
|
||||
LOCALE_TARGET = 'bearhub.gems.web.controller.locale.getlocale'
|
||||
|
||||
|
||||
class ControllerTest(TestCase):
|
||||
|
||||
22
tests/gems/web/test_namespace.py
Normal file
22
tests/gems/web/test_namespace.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from bearhub.gems.web.controller import WebApplicationManager
|
||||
from bearhub.view.core.gems import _discover_gem_dirs, _import_controller_module
|
||||
|
||||
|
||||
class TestWebNamespace(TestCase):
|
||||
|
||||
def test_bauh_compat_import(self):
|
||||
from bauh.gems.web.controller import DEFAULT_LANGUAGE_HEADER
|
||||
|
||||
self.assertEqual('en-US, en', DEFAULT_LANGUAGE_HEADER)
|
||||
|
||||
def test_web_discovered_under_bearhub(self):
|
||||
gem_dirs = dict(_discover_gem_dirs())
|
||||
self.assertIn('web', gem_dirs)
|
||||
self.assertIn('bearhub/gems/web', gem_dirs['web'].replace('\\', '/'))
|
||||
|
||||
def test_controller_import_prefers_bearhub(self):
|
||||
module = _import_controller_module('web')
|
||||
self.assertEqual(module.__name__, 'bearhub.gems.web.controller')
|
||||
self.assertIs(module.WebApplicationManager, WebApplicationManager)
|
||||
21
tests/test_namespace_phase_d.py
Normal file
21
tests/test_namespace_phase_d.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from unittest import TestCase
|
||||
|
||||
import bearhub
|
||||
import bearhub.stylesheet
|
||||
import bauh
|
||||
|
||||
|
||||
class TestPhaseDVersionFlip(TestCase):
|
||||
|
||||
def test_version_canonical_in_bearhub(self):
|
||||
self.assertEqual('0.10.7', bearhub.__version__)
|
||||
self.assertEqual('bearhub', bearhub.__app_name__)
|
||||
|
||||
def test_bauh_shim_reexports_version(self):
|
||||
self.assertEqual(bearhub.__version__, bauh.__version__)
|
||||
self.assertEqual(bearhub.__app_name__, bauh.__app_name__)
|
||||
|
||||
def test_bauh_stylesheet_shim(self):
|
||||
from bauh import stylesheet as legacy_stylesheet
|
||||
|
||||
self.assertIs(legacy_stylesheet.process_var_of_vars, bearhub.stylesheet.process_var_of_vars)
|
||||
23
tests/view/core/test_namespace.py
Normal file
23
tests/view/core/test_namespace.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from bearhub.view.core.config import CoreConfigManager
|
||||
from bearhub.view.core.controller import GenericSoftwareManager
|
||||
from bearhub.view.core.gems import load_managers
|
||||
from bearhub.view.core.update import check_for_update
|
||||
|
||||
|
||||
class TestViewCoreNamespace(TestCase):
|
||||
|
||||
def test_bauh_compat_import(self):
|
||||
from bauh.view.core.config import CoreConfigManager as legacy_config
|
||||
|
||||
self.assertIs(legacy_config, CoreConfigManager)
|
||||
|
||||
def test_controller_importable_from_bearhub(self):
|
||||
self.assertTrue(callable(GenericSoftwareManager))
|
||||
|
||||
def test_gems_loader_native(self):
|
||||
self.assertTrue(callable(load_managers))
|
||||
|
||||
def test_update_check_callable(self):
|
||||
self.assertTrue(callable(check_for_update))
|
||||
0
tests/view/qt/__init__.py
Normal file
0
tests/view/qt/__init__.py
Normal file
19
tests/view/qt/test_namespace.py
Normal file
19
tests/view/qt/test_namespace.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from bearhub.view.qt.prepare import PreparePanel
|
||||
from bearhub.view.qt.window import ManageWindow
|
||||
from bearhub.view.qt.components import QtComponentsManager
|
||||
|
||||
|
||||
class TestViewQtNamespace(TestCase):
|
||||
|
||||
def test_bauh_compat_import(self):
|
||||
from bauh.view.qt.components import QtComponentsManager as legacy_manager
|
||||
|
||||
self.assertIs(legacy_manager, QtComponentsManager)
|
||||
|
||||
def test_prepare_panel_importable(self):
|
||||
self.assertTrue(callable(PreparePanel))
|
||||
|
||||
def test_window_importable(self):
|
||||
self.assertTrue(callable(ManageWindow))
|
||||
0
tests/view/util/__init__.py
Normal file
0
tests/view/util/__init__.py
Normal file
20
tests/view/util/test_namespace.py
Normal file
20
tests/view/util/test_namespace.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from bearhub.view.util.cache import DefaultMemoryCacheFactory
|
||||
from bearhub.view.util.resource import get_path
|
||||
from bearhub.view.util.translation import I18n
|
||||
|
||||
|
||||
class TestViewUtilNamespace(TestCase):
|
||||
|
||||
def test_bauh_compat_import(self):
|
||||
from bauh.view.util.cache import DefaultMemoryCacheFactory as legacy_factory
|
||||
|
||||
self.assertIs(legacy_factory, DefaultMemoryCacheFactory)
|
||||
|
||||
def test_resource_prefers_bearhub_tree(self):
|
||||
path = get_path('locale/about/en')
|
||||
self.assertIn('bearhub/view/resources', path.replace('\\', '/'))
|
||||
|
||||
def test_translation_class_available(self):
|
||||
self.assertTrue(callable(I18n))
|
||||
Reference in New Issue
Block a user