From 68d0c46a6a93580cd769b975295142e89fefbb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Mon, 27 Jan 2025 18:55:03 +0100 Subject: [PATCH] Add migration test for compatibility --- test/integration/test_migrations.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/integration/test_migrations.py b/test/integration/test_migrations.py index 233b0972975..e60c9a0d804 100644 --- a/test/integration/test_migrations.py +++ b/test/integration/test_migrations.py @@ -151,3 +151,29 @@ def test_back_default_compatibility_migration(): with patch('conan.api.conan_api.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 + +def test_migration_cppstd_compat_different_file(): + t = TestClient() + t.run("-v") + assert 'WARN: The "cppstd_compat.py" file is deprecated' not in t.out + + version_txt_file_path = os.path.join(t.cache_folder, "version.txt") + save(version_txt_file_path, "2.11") + + cppstd_compat_file = os.path.join(t.cache_folder, "extensions", "plugins", "compatibility", "cppstd_compat.py") + save(cppstd_compat_file, "custom file content") + + t.run("-v") + assert 'WARN: The "cppstd_compat.py" file is deprecated' in t.out + # Exists because it was not the default one + assert os.path.exists(cppstd_compat_file) + + save(version_txt_file_path, "2.11") + cppstd_compat_file = os.path.join(t.cache_folder, "extensions", "plugins", "compatibility", + "cppstd_compat.py") + save(cppstd_compat_file, "# This file was generated by Conan. Remove this comment if you edit this file or Conan") + + t.run("-v") + assert 'Migration: Successfully removed cppstd_compat.py' in t.out + # Removed because it was the default + assert not os.path.exists(cppstd_compat_file)