Skip to content

Commit

Permalink
Fix tests to add depends option
Browse files Browse the repository at this point in the history
  • Loading branch information
LyzardKing committed Sep 4, 2020
1 parent 20a5fe5 commit 9d70cf3
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 4 deletions.
6 changes: 6 additions & 0 deletions tests/data/duplicatedframeworks/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def setup(self, install_path=None, auto_accept_license=False):
def remove(self):
super().remove()

def depends(self):
super().depends()


class FrameworkB(umake.frameworks.BaseFramework):

Expand All @@ -53,3 +56,6 @@ def setup(self, install_path=None, auto_accept_license=False):

def remove(self):
super().remove()

def depends(self):
super().depends()
6 changes: 6 additions & 0 deletions tests/data/duplicatedframeworks/samecategory.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def setup(self, install_path=None, auto_accept_license=False):
def remove(self):
super().remove()

def depends(self):
super().depends()


class FrameworkD(umake.frameworks.BaseFramework):

Expand All @@ -53,3 +56,6 @@ def setup(self, install_path=None, auto_accept_license=False):

def remove(self):
super().remove()

def depends(self):
super().depends()
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ def setup(self, install_path=None, auto_accept_license=False):

def remove(self):
super().remove()

def depends(self):
super().depends()
6 changes: 6 additions & 0 deletions tests/data/multipledefaultsframeworks/twodefaultscategory.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def setup(self, install_path=None, auto_accept_license=False):
def remove(self):
super().remove()

def depends(self):
super().depends()


class FrameworkB(umake.frameworks.BaseFramework):

Expand All @@ -53,3 +56,6 @@ def setup(self, install_path=None, auto_accept_license=False):

def remove(self):
super().remove()

def depends(self):
super().depends()
6 changes: 6 additions & 0 deletions tests/data/overlayframeworks/duplicatedcategory.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def setup(self, install_path=None, auto_accept_license=False):
def remove(self):
super().remove()

def depends(self):
super().depends()


class FrameworkB(umake.frameworks.BaseFramework):

Expand All @@ -53,3 +56,6 @@ def setup(self, install_path=None, auto_accept_license=False):

def remove(self):
super().remove()

def depends(self):
super().depends()
6 changes: 6 additions & 0 deletions tests/data/overlayframeworks/duplicatedcategory2.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def setup(self, install_path=None, auto_accept_license=False):
def remove(self):
super().remove()

def depends(self):
super().depends()


class FrameworkB(umake.frameworks.BaseFramework):

Expand All @@ -53,3 +56,6 @@ def setup(self, install_path=None, auto_accept_license=False):

def remove(self):
super().remove()

def depends(self):
super().depends()
6 changes: 6 additions & 0 deletions tests/data/overlayframeworks/overlayframeworks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def setup(self, install_path=None, auto_accept_license=False):
def remove(self):
super().remove()

def depends(self):
super().depends()


class FrameworkB(umake.frameworks.BaseFramework):

Expand All @@ -53,3 +56,6 @@ def setup(self, install_path=None, auto_accept_license=False):

def remove(self):
super().remove()

def depends(self):
super().depends()
6 changes: 6 additions & 0 deletions tests/data/overlayframeworks/withcategory.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def setup(self, install_path=None, auto_accept_license=False):
def remove(self):
super().remove()

def depends(self):
super().depends()


class FrameworkB(umake.frameworks.BaseFramework):

Expand All @@ -53,3 +56,6 @@ def setup(self, install_path=None, auto_accept_license=False):

def remove(self):
super().remove()

def depends(self):
super().depends()
6 changes: 6 additions & 0 deletions tests/data/overlayframeworks/withcategory2.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def setup(self, install_path=None, auto_accept_license=False):
def remove(self):
super().remove()

def depends(self):
super().depends()


class FrameworkB(umake.frameworks.BaseFramework):

Expand All @@ -53,3 +56,6 @@ def setup(self, install_path=None, auto_accept_license=False):

def remove(self):
super().remove()

def depends(self):
super().depends()
11 changes: 9 additions & 2 deletions tests/small/test_frameworks_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ def test_parse_category_and_framework_run_correct_framework(self):
args.framework = "framework-b"
args.accept_license = False
args.remove = False
args.depends = False
with patch.object(self.CategoryHandler.categories[args.category].frameworks["framework-b"], "setup")\
as setup_call:
self.CategoryHandler.categories[args.category].run_for(args)
Expand All @@ -312,6 +313,7 @@ def test_parse_no_framework_run_default_for_category(self):
args.framework = None
args.accept_license = False
args.remove = False
args.depends = False
with patch.object(self.CategoryHandler.categories[args.category].frameworks["framework-a"], "setup")\
as setup_call:
self.CategoryHandler.categories[args.category].run_for(args)
Expand All @@ -327,11 +329,11 @@ def test_parse_category_and_framework_list_dependencies(self):
args.depends = True
args.accept_license = False
args.remove = False
with patch.object(self.CategoryHandler.categories[args.category].frameworks["framework-a"], "depends")\
with patch.object(self.CategoryHandler.categories[args.category].frameworks["framework-b"], "depends")\
as depends_call:
self.CategoryHandler.categories[args.category].run_for(args)
self.assertTrue(depends_call.called)
remove_call.assert_called_with()
depends_call.assert_called_with()
# self.assertEqual(setup_call.call_args, call(install_path=None, auto_accept_license=False))

def test_parse_category_and_framework_run_correct_remove_framework(self):
Expand Down Expand Up @@ -393,6 +395,7 @@ def test_parse_category_and_framework_cannot_install_not_installable_but_install
args.framework = "framework-r-installed-not-installable"
args.accept_license = False
args.remove = False
args.depends = False
self.assertRaises(BaseException, self.CategoryHandler.categories[args.category].run_for, args)

def test_parse_category_and_framework_can_remove_not_installable_but_installed_framework(self):
Expand All @@ -418,6 +421,7 @@ def test_parse_category_and_framework_get_accept_license_arg(self):
args.framework = "framework-b"
args.accept_license = True
args.remove = False
args.depends = False
with patch.object(self.CategoryHandler.categories[args.category].frameworks["framework-b"], "setup")\
as setup_call:
self.CategoryHandler.categories[args.category].run_for(args)
Expand Down Expand Up @@ -1305,6 +1309,9 @@ def setup(self):
def remove(self):
super().remove()

def depends(self):
super().depends()

@property
def is_installable(self):
return False
Expand Down
3 changes: 1 addition & 2 deletions umake/frameworks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from umake.settings import DEFAULT_INSTALL_TOOLS_PATH, UMAKE_FRAMEWORKS_ENVIRON_VARIABLE, DEFAULT_BINARY_LINK_PATH
from umake.tools import ConfigHandler, NoneDict, classproperty, get_current_arch, get_current_distro_version,\
is_completion_mode, switch_to_current_user, MainLoop, get_user_frameworks_path, get_current_distro_id
from umake.interactions import DisplayMessage
from umake.ui import UI


Expand Down Expand Up @@ -267,7 +266,7 @@ def setup(self):
@abc.abstractmethod
def depends(self):
"""Method call to list depends for current framework"""
if not self.is_installable:
if not self.is_installable and not self.is_installed:
logger.error(_("Framework {} is not installable".format(self.name)))
UI.return_main_screen(status_code=2)

Expand Down

0 comments on commit 9d70cf3

Please sign in to comment.