fixed broken unit tests
This commit is contained in:
parent
f499f71f64
commit
d95d169ac5
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
import spack
|
import spack
|
||||||
from spack.stage import Stage
|
from spack.stage import Stage
|
||||||
from spack.fetch_strategy import URLFetchStrategy
|
from spack.fetch_strategy import URLFetchStrategy, FetchStrategyComposite
|
||||||
from spack.directory_layout import YamlDirectoryLayout
|
from spack.directory_layout import YamlDirectoryLayout
|
||||||
from spack.util.executable import which
|
from spack.util.executable import which
|
||||||
from spack.test.mock_packages_test import *
|
from spack.test.mock_packages_test import *
|
||||||
@ -81,7 +81,10 @@ def test_install_and_uninstall(self):
|
|||||||
pkg = spack.db.get(spec)
|
pkg = spack.db.get(spec)
|
||||||
|
|
||||||
# Fake the URL for the package so it downloads from a file.
|
# Fake the URL for the package so it downloads from a file.
|
||||||
pkg.fetcher = URLFetchStrategy(self.repo.url)
|
|
||||||
|
fetcher = FetchStrategyComposite()
|
||||||
|
fetcher.append(URLFetchStrategy(self.repo.url))
|
||||||
|
pkg.fetcher = fetcher
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pkg.do_install()
|
pkg.do_install()
|
||||||
|
@ -81,17 +81,35 @@ def getter(*args, **kwargs):
|
|||||||
dictionary_for_type_call = {}
|
dictionary_for_type_call = {}
|
||||||
# Construct a dictionary with the methods explicitly passed as name
|
# Construct a dictionary with the methods explicitly passed as name
|
||||||
if method_list is not None:
|
if method_list is not None:
|
||||||
method_list_dict = {name: IterateOver(name) for name in method_list}
|
# python@2.7: method_list_dict = {name: IterateOver(name) for name in method_list}
|
||||||
|
method_list_dict = {}
|
||||||
|
for name in method_list:
|
||||||
|
method_list_dict[name] = IterateOver(name)
|
||||||
dictionary_for_type_call.update(method_list_dict)
|
dictionary_for_type_call.update(method_list_dict)
|
||||||
# Construct a dictionary with the methods inspected from the interface
|
# Construct a dictionary with the methods inspected from the interface
|
||||||
if interface is not None:
|
if interface is not None:
|
||||||
interface_methods = {name: method for name, method in inspect.getmembers(interface, predicate=no_special_no_private)}
|
##########
|
||||||
interface_methods_dict = {name: IterateOver(name, method) for name, method in interface_methods.iteritems()}
|
# python@2.7: interface_methods = {name: method for name, method in inspect.getmembers(interface, predicate=no_special_no_private)}
|
||||||
|
interface_methods = {}
|
||||||
|
for name, method in inspect.getmembers(interface, predicate=no_special_no_private):
|
||||||
|
interface_methods[name] = method
|
||||||
|
##########
|
||||||
|
# python@2.7: interface_methods_dict = {name: IterateOver(name, method) for name, method in interface_methods.iteritems()}
|
||||||
|
interface_methods_dict = {}
|
||||||
|
for name, method in interface_methods.iteritems():
|
||||||
|
interface_methods_dict[name] = IterateOver(name, method)
|
||||||
|
##########
|
||||||
dictionary_for_type_call.update(interface_methods_dict)
|
dictionary_for_type_call.update(interface_methods_dict)
|
||||||
# Get the methods that are defined in the scope of the composite class and override any previous definition
|
# Get the methods that are defined in the scope of the composite class and override any previous definition
|
||||||
cls_method = {name: method for name, method in inspect.getmembers(cls, predicate=inspect.ismethod)}
|
##########
|
||||||
|
# python@2.7: cls_method = {name: method for name, method in inspect.getmembers(cls, predicate=inspect.ismethod)}
|
||||||
|
cls_method = {}
|
||||||
|
for name, method in inspect.getmembers(cls, predicate=inspect.ismethod):
|
||||||
|
cls_method[name] = method
|
||||||
|
##########
|
||||||
dictionary_for_type_call.update(cls_method)
|
dictionary_for_type_call.update(cls_method)
|
||||||
# Generate the new class on the fly and return it
|
# Generate the new class on the fly and return it
|
||||||
|
# FIXME : inherit from interface if we start to use ABC classes?
|
||||||
wrapper_class = type(cls.__name__, (cls, container), dictionary_for_type_call)
|
wrapper_class = type(cls.__name__, (cls, container), dictionary_for_type_call)
|
||||||
return wrapper_class
|
return wrapper_class
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user