Skip to content

Commit

Permalink
Add migration test for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
AbrilRBS committed Jan 27, 2025
1 parent 78c87b8 commit 68d0c46
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/integration/test_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 68d0c46

Please sign in to comment.