Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AbrilRBS committed Jan 13, 2025
1 parent 6781b2b commit 954c501
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 6 deletions.
1 change: 0 additions & 1 deletion conan/api/conan_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def __init__(self, cache_folder=None):

def reinit(self):
self.config.reinit()
self.config.migrate()
self.remotes.reinit()
self.local.reinit()

Expand Down
2 changes: 1 addition & 1 deletion conan/api/subapi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from conan.internal.cache.home_paths import HomePaths
from conan.internal.conan_app import ConanApp
from conan.internal.default_settings import default_settings_yml
from conans.client.migrations import ClientMigrator
from conans.client.graph.graph import CONTEXT_HOST, RECIPE_VIRTUAL, Node
from conans.client.graph.graph_builder import DepsGraphBuilder
from conans.client.graph.profile_node_definer import consumer_definer
Expand Down Expand Up @@ -195,7 +196,6 @@ def appending_recursive_dict_update(d, u):
def migrate(self):
# Migration system
# TODO: A prettier refactoring of migrators would be nice
from conans.client.migrations import ClientMigrator
migrator = ClientMigrator(self.home(), conan_version)
migrator.migrate()

Expand Down
2 changes: 1 addition & 1 deletion conans/client/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import textwrap

from conan.api.output import ConanOutput
from conan.api.subapi.config import ConfigAPI
from conan.internal.default_settings import migrate_settings_file
from conans.migrations import Migrator
from conans.util.dates import timestamp_now
Expand Down Expand Up @@ -76,6 +75,7 @@ def migrate(home_folder):


def _migrate_pkg_db_lru(cache_folder, old_version):
from conan.api.subapi.config import ConfigAPI
config = ConfigAPI.load_config(cache_folder)
storage = config.get("core.cache:storage_path") or os.path.join(cache_folder, "p")
db_filename = os.path.join(storage, 'cache.sqlite3')
Expand Down
2 changes: 0 additions & 2 deletions test/integration/command/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,8 @@ def test_config_reinit():
assert config_api.global_conf.get("core.upload:retry", check_type=int) != 7

conan_api.config.install(global_conf_folder, verify_ssl=False)

# No effect yet, we haven't reinitialized the API after the config installation
assert config_api.global_conf.get("core.upload:retry", check_type=int) != 7

conan_api.reinit()

assert config_api.global_conf.get("core.upload:retry", check_type=int) == 7
2 changes: 1 addition & 1 deletion test/integration/test_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,6 @@ def test_back_default_compatibility_migration():
# simulate that we are in 2.3.2 and the old one is latest conan_version
migrator = ClientMigrator(t.cache_folder, Version("2.3.2"))

with patch('conan.api.conan_api.ClientMigrator', new=lambda *args, **kwargs: migrator):
with patch('conan.api.subapi.config.ClientMigrator', new=lambda *args, **kwargs: migrator):
t.run("-v") # Fire the backward migration
assert f"WARN: Downgrading cache from Conan {conan_version} to 2.3.2" in t.out

0 comments on commit 954c501

Please sign in to comment.