Skip to content

Commit

Permalink
Merge branch 'fix/version_error_at_first_round' into 'main'
Browse files Browse the repository at this point in the history
fix: wrongly terminate the version solver when web service versions not been found at the first round

See merge request espressif/idf-component-manager!352
  • Loading branch information
kumekay committed Feb 23, 2024
2 parents 6ae82df + 5f4a5a9 commit c522963
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
6 changes: 4 additions & 2 deletions idf_component_manager/version_solver/version_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import os

from idf_component_tools.errors import DependencySolveError, SolverError
from idf_component_tools.errors import DependencySolveError, FetchingError, SolverError
from idf_component_tools.manifest import (
ComponentRequirement,
ComponentWithVersions,
Expand Down Expand Up @@ -123,7 +123,9 @@ def get_versions_from_sources(
latest_source = source
if cmp_with_versions.versions:
break
except ComponentNotFound:
# ComponentNotFound will be raised by API client
# FetchingError will be raised by sources
except (ComponentNotFound, FetchingError):
pass
return cmp_with_versions, latest_source

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/test_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ def test_idf_check_target_fail_manifest(project):
def test_idf_check_target_fail_dependency(project):
res = set_target(project, 'esp32')
assert (
'Cannot find versions of "example/cmp" satisfying "0.0.1" for the current target "esp32"'
in res
'Because project depends on example/cmp (0.0.1) which doesn\'t match any versions, '
'version solving failed.' in res
)


Expand Down
33 changes: 32 additions & 1 deletion integration_tests/test_version_solver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import os
import shutil
Expand Down Expand Up @@ -474,3 +474,34 @@ def test_multiple_storage_urls(monkeypatch, project):
assert 'Configuring done' in output
assert 'example/cmp (3.3.3)' in output
assert 'test/cmp2 (1.0.0) from file:///' in output


@pytest.mark.parametrize(
'project',
[
{
'components': {
'main': {
'dependencies': {
'usb_host_ch34x_vcp': {'version': '^2'},
'usb_host_cp210x_vcp': {'version': '^2'},
'usb_host_ftdi_vcp': {'version': '^2'},
'usb_host_vcp': {'version': '^1'},
}
},
},
}
],
indirect=True,
)
@pytest.mark.skipif(
(os.getenv('IDF_BRANCH', 'master') or 'master') != 'master',
reason='only test it in master branch',
)
def test_complex_version_solving(monkeypatch, project):
output = project_action(project, 'reconfigure')
assert 'version solving failed' in output

shutil.rmtree(os.path.join(project, 'build'))
output = project_action(project, '--preview', 'set-target', 'esp32p4', 'reconfigure')
assert 'Configuring done' in output

0 comments on commit c522963

Please sign in to comment.