Skip to content

Instantly share code, notes, and snippets.

@Makman2
Created May 5, 2016 14:28
Show Gist options
  • Save Makman2/a093c14125916f310ec220f6f167f661 to your computer and use it in GitHub Desktop.
Save Makman2/a093c14125916f310ec220f6f167f661 to your computer and use it in GitHub Desktop.
coala master fails (5.5.2016)
============================= test session starts ==============================
platform linux -- Python 3.4.3, pytest-2.8.7, py-1.4.31, pluggy-0.3.1
rootdir: /home/mak/dev/coala, inifile: setup.cfg
plugins: timeout-1.0.0, xdist-1.14, doc-0.0.1, env-0.6.0, cov-2.2.1
collected 549 items
coalib/bears/Bear.py .
coalib/collecting/Importers.py .
coalib/misc/Annotations.py .
coalib/misc/Decorators.py ..
coalib/misc/Shell.py .
coalib/parsing/Globbing.py .
coalib/parsing/StringProcessing/InBetweenMatch.py .
coalib/results/AbsolutePosition.py .
coalib/settings/ConfigurationGathering.py .
coalib/settings/FunctionMetadata.py ..
docs/index.rst s
docs/General_Dev_Info/git_tutorial_1.rst s
docs/Getting_Involved/Codestyle.rst s
docs/Getting_Involved/MAC_Hints.rst s
docs/Getting_Involved/Newcomers.rst s
docs/Getting_Involved/README.rst s
docs/Getting_Involved/Review.rst s
docs/Getting_Involved/Testing.rst s
docs/Getting_Involved/Writing_Documentation.rst s
docs/Getting_Involved/Writing_Good_Commits.rst s
docs/Getting_Involved/Writing_Tests.rst s
docs/Users/Exit_Codes.rst s
docs/Users/External_APIs.rst s
docs/Users/Git_Hooks.rst s
docs/Users/Glob_Patterns.rst .
docs/Users/Install.rst s
docs/Users/coafile.rst s
docs/Users/Tutorials/Auto_Completion.rst s
docs/Users/Tutorials/Git_Help.rst s
docs/Users/Tutorials/Linter_Bears.rst s
docs/Users/Tutorials/Self_Correcting_Bears.rst s
docs/Users/Tutorials/Testing_Bears.rst s
docs/Users/Tutorials/Tutorial.rst s
docs/Users/Tutorials/Writing_Bears.rst s
tests/MakeTempTest.py .
tests/coalaCITest.py .......
tests/coalaDbusTest.py .
tests/coalaDeleteOrigTest.py ..
tests/coalaFormatTest.py .
tests/coalaJSONTest.py ......
tests/coalaTest.py ......
tests/bearlib/abstractions/LintTest.py .........
tests/bearlib/abstractions/LinterTest.py .....................
tests/bearlib/abstractions/SectionCreatableTest.py ...
tests/bearlib/languages/LanguageDefinitionTest.py ...
tests/bearlib/languages/documentation/DocstyleDefinitionTest.py ...
tests/bearlib/languages/documentation/DocumentationCommentTest.py .
tests/bearlib/languages/documentation/DocumentationExtractionTest.py ........
tests/bearlib/spacing/SpacingHelperTest.py .....
tests/bears/BearTest.py ........
tests/bears/GlobalBearTest.py ..
tests/bears/LocalBearTest.py ..
tests/collecting/CollectorsTest.py ......................
tests/collecting/DependenciesTest.py ...
tests/collecting/ImportersTest.py ........
tests/misc/AnnotationsTest.py ......
tests/misc/BuildManPageTest.py .........
tests/misc/ContextManagersTest.py ........
tests/misc/DecoratorsTest.py ...............
tests/misc/DictUtilitiesTest.py ..
tests/misc/EnumTest.py ..
tests/misc/ExceptionsTest.py .
tests/misc/ShellTest.py ...........
tests/misc/StringConverterTest.py .............
tests/output/ConfWriterTest.py ..
tests/output/ConsoleInteractionTest.py .............................
tests/output/InteractionsTest.py .
tests/output/JSONEncoderTest.py ..........
tests/output/TaggingTest.py ....
tests/output/dbus/BuildDbusServiceTest.py .
tests/output/dbus/DbusAppTest.py .
tests/output/dbus/DbusDocumentTest.py ...
tests/output/dbus/DbusServerTest.py .....
tests/output/dbus/DbusTest.py F
tests/output/printers/ListLogPrinterTest.py .
tests/output/printers/LogPrinterTest.py ....
tests/parsing/CliParsingTest.py ..
tests/parsing/ConfParserTest.py .......
tests/parsing/GlobbingTest.py ...............................
tests/parsing/LineParserTest.py ......
tests/parsing/StringProcessing/ConvertToRawTest.py .
tests/parsing/StringProcessing/EscapeTest.py ....
tests/parsing/StringProcessing/InBetweenMatchTest.py ...
tests/parsing/StringProcessing/LimitTest.py ..
tests/parsing/StringProcessing/MatchTest.py ..
tests/parsing/StringProcessing/NestedSearchInBetweenTest.py ......
tests/parsing/StringProcessing/PositionIsEscapedTest.py ..
tests/parsing/StringProcessing/SearchForTest.py .....
tests/parsing/StringProcessing/SearchInBetweenTest.py ......
tests/parsing/StringProcessing/SplitTest.py .....
tests/parsing/StringProcessing/TrimEmptyMatchesTest.py ..
tests/parsing/StringProcessing/UnescapeTest.py ..
tests/parsing/StringProcessing/UnescapedSearchForTest.py ......
tests/parsing/StringProcessing/UnescapedSearchInBetweenTest.py ......
tests/parsing/StringProcessing/UnescapedSplitTest.py .....
tests/parsing/StringProcessing/UnescapedStripTest.py ...
tests/processes/BearRunningTest.py ......
tests/processes/LogPrinterThreadTest.py .
tests/processes/ProcessingTest.py ......................
tests/processes/communication/LogMessageTest.py ....
tests/results/AbsolutePositionTest.py ......
tests/results/DiffTest.py ..........
tests/results/HiddenResultTest.py .
tests/results/LineDiffTest.py ..
tests/results/RESULT_SEVERITYTest.py .
tests/results/ResultFilterTest.py ...........
tests/results/ResultTest.py ........
tests/results/SourcePositionTest.py ...
tests/results/SourceRangeTest.py ..........
tests/results/TextPositionTest.py ..
tests/results/TextRangeTest.py ..........
tests/results/result_actions/ApplyPatchActionTest.py ......
tests/results/result_actions/OpenEditorActionTest.py ...
tests/results/result_actions/PrintDebugMessageActionTest.py ..
tests/results/result_actions/PrintMoreInfoActionTest.py ..
tests/results/result_actions/ResultActionTest.py .
tests/results/result_actions/ShowPatchActionTest.py ...
tests/settings/ConfigurationGatheringTest.py ..FFFFFF.FF
tests/settings/DocumentationCommentTest.py ..
tests/settings/FunctionMetadataTest.py .....
tests/settings/SectionFillingTest.py ..
tests/settings/SectionTest.py ............
tests/settings/SettingTest.py ..........
=========================== short test summary info ============================
SKIP [23] /usr/lib/python3.4/site-packages/_pytest/doctest.py:165: all tests skipped by +SKIP option
=================================== FAILURES ===================================
______________________________ DbusTest.test_dbus ______________________________
self = <tests.output.dbus.DbusTest.DbusTest testMethod=test_dbus>
def test_dbus(self):
self.document_object_path = self.remote_object.CreateDocument(
self.testcode_c_path,
dbus_interface="org.coala_analyzer.v1")
self.assertRegex(str(self.document_object_path),
r"^/org/coala_analyzer/v1/test/\d+/documents/\d+$")
self.document_object = self.bus.get_object(
"org.coala_analyzer.v1.test",
self.document_object_path)
config_file = self.document_object.SetConfigFile(
"dummy_config",
dbus_interface="org.coala_analyzer.v1")
self.assertEqual(config_file, "dummy_config")
config_file = self.document_object.GetConfigFile(
dbus_interface="org.coala_analyzer.v1")
self.assertEqual(config_file, "dummy_config")
config_file = self.document_object.FindConfigFile(
dbus_interface="org.coala_analyzer.v1")
self.assertEqual(config_file, self.config_path)
analysis = self.document_object.Analyze(
dbus_interface="org.coala_analyzer.v1")
self.maxDiff = None
print(analysis)
# Run some basic analysis with good debug messages.
> self.assertEqual(analysis[0], 1, "Exit code was not 1.")
E AssertionError: dbus.Int32(13) != 1 : Exit code was not 1.
tests/output/dbus/DbusTest.py:113: AssertionError
----------------------------- Captured stdout call -----------------------------
dbus.Struct((dbus.Int32(13), dbus.Array([dbus.Dictionary({dbus.String('timestamp'): dbus.String('2016-05-05T16:28:21.382892'), dbus.String('log_level'): dbus.String('ERROR'), dbus.String('message'): dbus.String('There is a conflict in the version of a dependency you have installed and the requirements of coala. This may be resolved by creating a separate virtual environment for coala or running `pip install coala>=0.6.0.dev20160426093137`. Be aware that the latter solution might break other python packages that depend on the currently installed version.')}, signature=dbus.Signature('ss'))], signature=dbus.Signature('a{ss}')), dbus.Array([], signature=dbus.Signature('(sbaa{ss})'))), signature=None)
___________ ConfigurationGatheringTest.test_default_coafile_parsing ____________
self = <tests.settings.ConfigurationGatheringTest.ConfigurationGatheringTest testMethod=test_default_coafile_parsing>
def test_default_coafile_parsing(self):
tmp = Constants.system_coafile
Constants.system_coafile = os.path.abspath(os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"section_manager_test_files",
"default_coafile"))
sections, local_bears, global_bears, targets = gather_configuration(
lambda *args: True,
self.log_printer,
> arg_list=[])
tests/settings/ConfigurationGatheringTest.py:71:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coalib/settings/ConfigurationGathering.py:310: in gather_configuration
log_printer)
coalib/settings/SectionFilling.py:38: in fill_settings
fill_section(section, acquire_settings, log_printer, all_bears)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
section = <Section object(contents=OrderedDict([('files', <Setting object(key='files', value='', origin='/home/mak/dev/coala/tes..._cli=False) at 0x7f3009578208>)]), defaults=None, name='Default') at 0x7f3009578630>, name='test-2') at 0x7f30095782b0>
acquire_settings = <function ConfigurationGatheringTest.test_default_coafile_parsing.<locals>.<lambda> at 0x7f300988c8c8>
log_printer = <coalib.output.printers.LogPrinter.LogPrinter object at 0x7f3009578cc0>
bears = [<class 'LineCountBear.LineCountBear'>]
def fill_section(section, acquire_settings, log_printer, bears):
"""
Retrieves needed settings from given bears and asks the user for
missing values.
If a setting is requested by several bears, the help text from the
latest bear will be taken.
:param section: A section containing available settings. Settings
will be added if some are missing.
:param acquire_settings: The method to use for requesting settings. It will
get a parameter which is a dictionary with the
settings name as key and a list containing a
description in [0] and the names of the bears
who need this setting in all following indexes.
:param log_printer: The log printer for logging.
:param bears: All bear classes or instances.
:return: The new section.
"""
# Retrieve needed settings.
prel_needed_settings = {}
for bear in bears:
if not hasattr(bear, "get_non_optional_settings"):
log_printer.log(
LOG_LEVEL.WARNING,
"One of the given bears ({}) has no attribute "
"get_non_optional_settings.".format(str(bear)))
else:
needed = bear.get_non_optional_settings()
for key in needed:
if key in prel_needed_settings:
prel_needed_settings[key].append(bear.name)
else:
prel_needed_settings[key] = [needed[key][0],
bear.name]
# Strip away existent settings.
needed_settings = {}
for setting, help_text in prel_needed_settings.items():
if not setting in section:
needed_settings[setting] = help_text
# Get missing ones.
if len(needed_settings) > 0:
new_vals = acquire_settings(log_printer, needed_settings)
> for setting, help_text in new_vals.items():
E AttributeError: 'bool' object has no attribute 'items'
coalib/settings/SectionFilling.py:91: AttributeError
_______________ ConfigurationGatheringTest.test_find_user_config _______________
self = <tests.settings.ConfigurationGatheringTest.ConfigurationGatheringTest testMethod=test_find_user_config>
def test_find_user_config(self):
current_dir = os.path.abspath(os.path.dirname(__file__))
c_file = os.path.join(current_dir,
"section_manager_test_files",
"project",
"test.c")
retval = find_user_config(c_file, 1)
self.assertEqual("", retval)
retval = find_user_config(c_file, 2)
self.assertEqual(os.path.join(current_dir,
"section_manager_test_files",
".coafile"), retval)
child_dir = os.path.join(current_dir,
"section_manager_test_files",
"child_dir")
retval = find_user_config(child_dir, 2)
self.assertEqual(os.path.join(current_dir,
"section_manager_test_files",
"child_dir",
".coafile"), retval)
with change_directory(child_dir):
sections, _, _, _ = gather_configuration(
lambda *args: True,
self.log_printer,
> arg_list=["--find-config"])
tests/settings/ConfigurationGatheringTest.py:244:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coalib/settings/ConfigurationGathering.py:310: in gather_configuration
log_printer)
coalib/settings/SectionFilling.py:38: in fill_settings
fill_section(section, acquire_settings, log_printer, all_bears)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
section = <Section object(contents=OrderedDict([('files', <Setting object(key='files', value='', origin='/home/mak/dev/coala/tes...m_cli=True) at 0x7f3009541390>)]), defaults=None, name='Default') at 0x7f3009541898>, name='test-2') at 0x7f3009628c50>
acquire_settings = <function ConfigurationGatheringTest.test_find_user_config.<locals>.<lambda> at 0x7f3009563158>
log_printer = <coalib.output.printers.LogPrinter.LogPrinter object at 0x7f300954a518>
bears = [<class 'LineCountBear.LineCountBear'>]
def fill_section(section, acquire_settings, log_printer, bears):
"""
Retrieves needed settings from given bears and asks the user for
missing values.
If a setting is requested by several bears, the help text from the
latest bear will be taken.
:param section: A section containing available settings. Settings
will be added if some are missing.
:param acquire_settings: The method to use for requesting settings. It will
get a parameter which is a dictionary with the
settings name as key and a list containing a
description in [0] and the names of the bears
who need this setting in all following indexes.
:param log_printer: The log printer for logging.
:param bears: All bear classes or instances.
:return: The new section.
"""
# Retrieve needed settings.
prel_needed_settings = {}
for bear in bears:
if not hasattr(bear, "get_non_optional_settings"):
log_printer.log(
LOG_LEVEL.WARNING,
"One of the given bears ({}) has no attribute "
"get_non_optional_settings.".format(str(bear)))
else:
needed = bear.get_non_optional_settings()
for key in needed:
if key in prel_needed_settings:
prel_needed_settings[key].append(bear.name)
else:
prel_needed_settings[key] = [needed[key][0],
bear.name]
# Strip away existent settings.
needed_settings = {}
for setting, help_text in prel_needed_settings.items():
if not setting in section:
needed_settings[setting] = help_text
# Get missing ones.
if len(needed_settings) > 0:
new_vals = acquire_settings(log_printer, needed_settings)
> for setting, help_text in new_vals.items():
E AttributeError: 'bool' object has no attribute 'items'
coalib/settings/SectionFilling.py:91: AttributeError
_____________ ConfigurationGatheringTest.test_gather_configuration _____________
self = <tests.settings.ConfigurationGatheringTest.ConfigurationGatheringTest testMethod=test_gather_configuration>
def test_gather_configuration(self):
args = (lambda *args: True, self.log_printer)
# Passing the default coafile name only triggers a warning.
> gather_configuration(*args, arg_list=["-c abcdefghi/invalid/.coafile"])
tests/settings/ConfigurationGatheringTest.py:29:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coalib/settings/ConfigurationGathering.py:310: in gather_configuration
log_printer)
coalib/settings/SectionFilling.py:38: in fill_settings
fill_section(section, acquire_settings, log_printer, all_bears)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
section = <Section object(contents=OrderedDict([('files', <Setting object(key='files', value='', origin='/home/mak/dev/coala/tes...m_cli=True) at 0x7f300d73a860>)]), defaults=None, name='Default') at 0x7f300d73afd0>, name='test-2') at 0x7f3009895ac8>
acquire_settings = <function ConfigurationGatheringTest.test_gather_configuration.<locals>.<lambda> at 0x7f3009563510>
log_printer = <coalib.output.printers.LogPrinter.LogPrinter object at 0x7f300954a588>
bears = [<class 'LineCountBear.LineCountBear'>]
def fill_section(section, acquire_settings, log_printer, bears):
"""
Retrieves needed settings from given bears and asks the user for
missing values.
If a setting is requested by several bears, the help text from the
latest bear will be taken.
:param section: A section containing available settings. Settings
will be added if some are missing.
:param acquire_settings: The method to use for requesting settings. It will
get a parameter which is a dictionary with the
settings name as key and a list containing a
description in [0] and the names of the bears
who need this setting in all following indexes.
:param log_printer: The log printer for logging.
:param bears: All bear classes or instances.
:return: The new section.
"""
# Retrieve needed settings.
prel_needed_settings = {}
for bear in bears:
if not hasattr(bear, "get_non_optional_settings"):
log_printer.log(
LOG_LEVEL.WARNING,
"One of the given bears ({}) has no attribute "
"get_non_optional_settings.".format(str(bear)))
else:
needed = bear.get_non_optional_settings()
for key in needed:
if key in prel_needed_settings:
prel_needed_settings[key].append(bear.name)
else:
prel_needed_settings[key] = [needed[key][0],
bear.name]
# Strip away existent settings.
needed_settings = {}
for setting, help_text in prel_needed_settings.items():
if not setting in section:
needed_settings[setting] = help_text
# Get missing ones.
if len(needed_settings) > 0:
new_vals = acquire_settings(log_printer, needed_settings)
> for setting, help_text in new_vals.items():
E AttributeError: 'bool' object has no attribute 'items'
coalib/settings/SectionFilling.py:91: AttributeError
____________________ ConfigurationGatheringTest.test_merge _____________________
self = <tests.settings.ConfigurationGatheringTest.ConfigurationGatheringTest testMethod=test_merge>
def test_merge(self):
tmp = Constants.system_coafile
Constants.system_coafile = os.path.abspath(os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"section_manager_test_files",
"default_coafile"))
config = os.path.abspath(os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"section_manager_test_files",
".coafile"))
# Check merging of default_coafile and .coafile
sections, local_bears, global_bears, targets = gather_configuration(
lambda *args: True,
self.log_printer,
> arg_list=["-c", re.escape(config)])
tests/settings/ConfigurationGatheringTest.py:129:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coalib/settings/ConfigurationGathering.py:310: in gather_configuration
log_printer)
coalib/settings/SectionFilling.py:38: in fill_settings
fill_section(section, acquire_settings, log_printer, all_bears)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
section = <Section object(contents=OrderedDict([('files', <Setting object(key='files', value='.', origin='/home/mak/dev/coala/te...m_cli=True) at 0x7f300954ae10>)]), defaults=None, name='Default') at 0x7f300953fcc0>, name='test-2') at 0x7f30096284a8>
acquire_settings = <function ConfigurationGatheringTest.test_merge.<locals>.<lambda> at 0x7f3009563a60>
log_printer = <coalib.output.printers.LogPrinter.LogPrinter object at 0x7f3009570438>
bears = [<class 'LineCountBear.LineCountBear'>]
def fill_section(section, acquire_settings, log_printer, bears):
"""
Retrieves needed settings from given bears and asks the user for
missing values.
If a setting is requested by several bears, the help text from the
latest bear will be taken.
:param section: A section containing available settings. Settings
will be added if some are missing.
:param acquire_settings: The method to use for requesting settings. It will
get a parameter which is a dictionary with the
settings name as key and a list containing a
description in [0] and the names of the bears
who need this setting in all following indexes.
:param log_printer: The log printer for logging.
:param bears: All bear classes or instances.
:return: The new section.
"""
# Retrieve needed settings.
prel_needed_settings = {}
for bear in bears:
if not hasattr(bear, "get_non_optional_settings"):
log_printer.log(
LOG_LEVEL.WARNING,
"One of the given bears ({}) has no attribute "
"get_non_optional_settings.".format(str(bear)))
else:
needed = bear.get_non_optional_settings()
for key in needed:
if key in prel_needed_settings:
prel_needed_settings[key].append(bear.name)
else:
prel_needed_settings[key] = [needed[key][0],
bear.name]
# Strip away existent settings.
needed_settings = {}
for setting, help_text in prel_needed_settings.items():
if not setting in section:
needed_settings[setting] = help_text
# Get missing ones.
if len(needed_settings) > 0:
new_vals = acquire_settings(log_printer, needed_settings)
> for setting, help_text in new_vals.items():
E AttributeError: 'bool' object has no attribute 'items'
coalib/settings/SectionFilling.py:91: AttributeError
________________ ConfigurationGatheringTest.test_merge_defaults ________________
self = <tests.settings.ConfigurationGatheringTest.ConfigurationGatheringTest testMethod=test_merge_defaults>
def test_merge_defaults(self):
with make_temp() as temporary:
sections, local_bears, global_bears, targets = (
gather_configuration(lambda *args: True,
self.log_printer,
arg_list=["-S",
"value=1",
"test.value=2",
"-c",
> escape(temporary, "\\")]))
tests/settings/ConfigurationGatheringTest.py:168:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coalib/settings/ConfigurationGathering.py:310: in gather_configuration
log_printer)
coalib/settings/SectionFilling.py:38: in fill_settings
fill_section(section, acquire_settings, log_printer, all_bears)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
section = <Section object(contents=OrderedDict([('files', <Setting object(key='files', value='', origin='/home/mak/dev/coala/tes...m_cli=True) at 0x7f3009570898>)]), defaults=None, name='Default') at 0x7f30095705c0>, name='test-2') at 0x7f300d76dc88>
acquire_settings = <function ConfigurationGatheringTest.test_merge_defaults.<locals>.<lambda> at 0x7f3009563c80>
log_printer = <coalib.output.printers.LogPrinter.LogPrinter object at 0x7f3009541c88>
bears = [<class 'LineCountBear.LineCountBear'>]
def fill_section(section, acquire_settings, log_printer, bears):
"""
Retrieves needed settings from given bears and asks the user for
missing values.
If a setting is requested by several bears, the help text from the
latest bear will be taken.
:param section: A section containing available settings. Settings
will be added if some are missing.
:param acquire_settings: The method to use for requesting settings. It will
get a parameter which is a dictionary with the
settings name as key and a list containing a
description in [0] and the names of the bears
who need this setting in all following indexes.
:param log_printer: The log printer for logging.
:param bears: All bear classes or instances.
:return: The new section.
"""
# Retrieve needed settings.
prel_needed_settings = {}
for bear in bears:
if not hasattr(bear, "get_non_optional_settings"):
log_printer.log(
LOG_LEVEL.WARNING,
"One of the given bears ({}) has no attribute "
"get_non_optional_settings.".format(str(bear)))
else:
needed = bear.get_non_optional_settings()
for key in needed:
if key in prel_needed_settings:
prel_needed_settings[key].append(bear.name)
else:
prel_needed_settings[key] = [needed[key][0],
bear.name]
# Strip away existent settings.
needed_settings = {}
for setting, help_text in prel_needed_settings.items():
if not setting in section:
needed_settings[setting] = help_text
# Get missing ones.
if len(needed_settings) > 0:
new_vals = acquire_settings(log_printer, needed_settings)
> for setting, help_text in new_vals.items():
E AttributeError: 'bool' object has no attribute 'items'
coalib/settings/SectionFilling.py:91: AttributeError
__________________ ConfigurationGatheringTest.test_no_config ___________________
self = <tests.settings.ConfigurationGatheringTest.ConfigurationGatheringTest testMethod=test_no_config>
def test_no_config(self):
current_dir = os.path.abspath(os.path.dirname(__file__))
child_dir = os.path.join(current_dir,
"section_manager_test_files",
"child_dir")
with change_directory(child_dir):
> sections, targets = load_configuration([], self.log_printer)
tests/settings/ConfigurationGatheringTest.py:253:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coalib/settings/ConfigurationGathering.py:155: in load_configuration
coafile_sections = load_config_file(config, log_printer, silent=save)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
filename = '/home/mak/dev/coala/tests/settings/section_manager_test_files/child_dir/tests/settings/section_manager_test_files/other_coafile'
log_printer = <coalib.output.printers.LogPrinter.LogPrinter object at 0x7f300962fb38>
silent = False
def load_config_file(filename, log_printer, silent=False):
"""
Loads sections from a config file. Prints an appropriate warning if
it doesn't exist and returns a section dict containing an empty
default section in that case.
It assumes that the cli_sections are available.
:param filename: The file to load settings from.
:param log_printer: The log printer to log the warning/error to (in case).
:param silent: Whether or not to warn the user/exit if the file
doesn't exist.
:raises SystemExit: Exits when given filename is invalid and is not the
default coafile. Only raised when ``silent`` is
``False``.
"""
filename = os.path.abspath(filename)
try:
return ConfParser().parse(filename)
except FileNotFoundError:
if not silent:
if os.path.basename(filename) == Constants.default_coafile:
log_printer.warn("The default coafile " +
repr(Constants.default_coafile) + " was not "
"found. Ignoring it.")
else:
log_printer.err("The requested coafile " + repr(filename) +
" does not exist.")
> sys.exit(2)
E SystemExit: 2
coalib/settings/ConfigurationGathering.py:65: SystemExit
___________________ ConfigurationGatheringTest.test_targets ____________________
self = <tests.settings.ConfigurationGatheringTest.ConfigurationGatheringTest testMethod=test_targets>
def test_targets(self):
sections, local_bears, global_bears, targets = gather_configuration(
lambda *args: True,
self.log_printer,
> arg_list=["default", "test1", "test2"])
tests/settings/ConfigurationGatheringTest.py:212:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coalib/settings/ConfigurationGathering.py:310: in gather_configuration
log_printer)
coalib/settings/SectionFilling.py:38: in fill_settings
fill_section(section, acquire_settings, log_printer, all_bears)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
section = <Section object(contents=OrderedDict([('files', <Setting object(key='files', value='', origin='/home/mak/dev/coala/tes..._cli=False) at 0x7f3009604a58>)]), defaults=None, name='Default') at 0x7f3009604eb8>, name='test-2') at 0x7f3009455f28>
acquire_settings = <function ConfigurationGatheringTest.test_targets.<locals>.<lambda> at 0x7f30096021e0>
log_printer = <coalib.output.printers.LogPrinter.LogPrinter object at 0x7f30096041d0>
bears = [<class 'LineCountBear.LineCountBear'>]
def fill_section(section, acquire_settings, log_printer, bears):
"""
Retrieves needed settings from given bears and asks the user for
missing values.
If a setting is requested by several bears, the help text from the
latest bear will be taken.
:param section: A section containing available settings. Settings
will be added if some are missing.
:param acquire_settings: The method to use for requesting settings. It will
get a parameter which is a dictionary with the
settings name as key and a list containing a
description in [0] and the names of the bears
who need this setting in all following indexes.
:param log_printer: The log printer for logging.
:param bears: All bear classes or instances.
:return: The new section.
"""
# Retrieve needed settings.
prel_needed_settings = {}
for bear in bears:
if not hasattr(bear, "get_non_optional_settings"):
log_printer.log(
LOG_LEVEL.WARNING,
"One of the given bears ({}) has no attribute "
"get_non_optional_settings.".format(str(bear)))
else:
needed = bear.get_non_optional_settings()
for key in needed:
if key in prel_needed_settings:
prel_needed_settings[key].append(bear.name)
else:
prel_needed_settings[key] = [needed[key][0],
bear.name]
# Strip away existent settings.
needed_settings = {}
for setting, help_text in prel_needed_settings.items():
if not setting in section:
needed_settings[setting] = help_text
# Get missing ones.
if len(needed_settings) > 0:
new_vals = acquire_settings(log_printer, needed_settings)
> for setting, help_text in new_vals.items():
E AttributeError: 'bool' object has no attribute 'items'
coalib/settings/SectionFilling.py:91: AttributeError
_____________ ConfigurationGatheringTest.test_user_coafile_parsing _____________
self = <tests.settings.ConfigurationGatheringTest.ConfigurationGatheringTest testMethod=test_user_coafile_parsing>
def test_user_coafile_parsing(self):
tmp = Constants.user_coafile
Constants.user_coafile = os.path.abspath(os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"section_manager_test_files",
"default_coafile"))
sections, local_bears, global_bears, targets = gather_configuration(
lambda *args: True,
self.log_printer,
> arg_list=[])
tests/settings/ConfigurationGatheringTest.py:89:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
coalib/settings/ConfigurationGathering.py:310: in gather_configuration
log_printer)
coalib/settings/SectionFilling.py:38: in fill_settings
fill_section(section, acquire_settings, log_printer, all_bears)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
section = <Section object(contents=OrderedDict([('files', <Setting object(key='files', value='', origin='/home/mak/dev/coala/tes..._cli=False) at 0x7f30094748d0>)]), defaults=None, name='Default') at 0x7f30094743c8>, name='test-2') at 0x7f30094747f0>
acquire_settings = <function ConfigurationGatheringTest.test_user_coafile_parsing.<locals>.<lambda> at 0x7f3009602730>
log_printer = <coalib.output.printers.LogPrinter.LogPrinter object at 0x7f3009541668>
bears = [<class 'LineCountBear.LineCountBear'>]
def fill_section(section, acquire_settings, log_printer, bears):
"""
Retrieves needed settings from given bears and asks the user for
missing values.
If a setting is requested by several bears, the help text from the
latest bear will be taken.
:param section: A section containing available settings. Settings
will be added if some are missing.
:param acquire_settings: The method to use for requesting settings. It will
get a parameter which is a dictionary with the
settings name as key and a list containing a
description in [0] and the names of the bears
who need this setting in all following indexes.
:param log_printer: The log printer for logging.
:param bears: All bear classes or instances.
:return: The new section.
"""
# Retrieve needed settings.
prel_needed_settings = {}
for bear in bears:
if not hasattr(bear, "get_non_optional_settings"):
log_printer.log(
LOG_LEVEL.WARNING,
"One of the given bears ({}) has no attribute "
"get_non_optional_settings.".format(str(bear)))
else:
needed = bear.get_non_optional_settings()
for key in needed:
if key in prel_needed_settings:
prel_needed_settings[key].append(bear.name)
else:
prel_needed_settings[key] = [needed[key][0],
bear.name]
# Strip away existent settings.
needed_settings = {}
for setting, help_text in prel_needed_settings.items():
if not setting in section:
needed_settings[setting] = help_text
# Get missing ones.
if len(needed_settings) > 0:
new_vals = acquire_settings(log_printer, needed_settings)
> for setting, help_text in new_vals.items():
E AttributeError: 'bool' object has no attribute 'items'
coalib/settings/SectionFilling.py:91: AttributeError
===== 9 failed, 517 passed, 23 skipped, 6 pytest-warnings in 26.27 seconds =====
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment