Skip to content

Commit

Permalink
fix codacy issues
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Heinrich <[email protected]>
  • Loading branch information
andistorm committed Dec 5, 2023
1 parent ef82c4e commit 6aec2a2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion modules/ErrorHistory/ErrorDatabaseSqlite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace module {

class ErrorDatabaseSqlite : public Everest::error::ErrorDatabase {
public:
ErrorDatabaseSqlite(const fs::path& db_path_, const bool reset_ = false);
explicit ErrorDatabaseSqlite(const fs::path& db_path_, const bool reset_ = false);

void add_error(Everest::error::ErrorPtr error) override;
std::list<Everest::error::ErrorPtr>
Expand Down
2 changes: 1 addition & 1 deletion modules/ErrorHistory/tests/helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void check_expected_errors_in_list(const std::vector<Everest::error::ErrorPtr>&
///
class TestDatabase {
public:
TestDatabase(const fs::path& db_path_, const bool reset_ = false);
explicit TestDatabase(const fs::path& db_path_, const bool reset_ = false);
~TestDatabase();
void add_error(Everest::error::ErrorPtr error);
std::list<Everest::error::ErrorPtr> get_errors(const std::list<Everest::error::ErrorFilter>& filters) const;
Expand Down
16 changes: 8 additions & 8 deletions tests/core_tests/error_history_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Copyright Pionix GmbH and Contributors to EVerest

from copy import deepcopy
import logging
from typing import Dict
import uuid
import pytest
Expand All @@ -24,20 +23,22 @@ def assert_error(expected_error, error):

def assert_errors(expected_errors, errors):
assert len(expected_errors) == len(errors)
for index_exp in range(len(expected_errors)):
for exp_err in expected_errors:
index = None
for i in range(len(errors)):
if expected_errors[index_exp]['uuid'] == errors[i]['uuid']:
for (i, err) in zip(range(len(errors)), errors):
if exp_err['uuid'] == err['uuid']:
if index is not None:
assert False, f'Found multiple errors with uuid {exp_err["uuid"]}'
index = i
break

assert index is not None
assert_error(expected_errors[index_exp], errors[index])
assert_error(exp_err, err)

class ErrorHistoryModuleConfigurationStrategy(EverestConfigAdjustmentStrategy):
def __init__(self, db_name):
self.db_name = db_name
def adjust_everest_configuration(self, everest_config: Dict) -> Dict:
db_path = f'/tmp/{self.db_name}.db'
db_path = f'{self.db_name}.db'
adjusted_config = deepcopy(everest_config)
module_config = adjusted_config['active_modules']['error_history']
module_config['config_implementation'] = {
Expand All @@ -53,7 +54,6 @@ def __init__(self):
super().__init__(db_name=db_name)
def adjust_everest_configuration(self, everest_config: Dict) -> Dict:
return super().adjust_everest_configuration(everest_config)


class TestErrorHistory:
"""
Expand Down

0 comments on commit 6aec2a2

Please sign in to comment.