From 11c30f6c69c4516b406c1c62f472d37898c58b93 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Mon, 4 Dec 2023 14:26:52 +0100
Subject: [PATCH] Run CI tests on Python 3.13, fix tests (#2673)

---
 docs/changelog/2673.feature.rst                          | 1 +
 tests/unit/create/test_creator.py                        | 6 +++++-
 tests/unit/create/via_global_ref/builtin/testing/path.py | 6 +++++-
 3 files changed, 11 insertions(+), 2 deletions(-)
 create mode 100644 docs/changelog/2673.feature.rst

diff --git a/docs/changelog/2673.feature.rst b/docs/changelog/2673.feature.rst
new file mode 100644
index 0000000..0adf4a0
--- /dev/null
+++ b/docs/changelog/2673.feature.rst
@@ -0,0 +1 @@
+The tests now pass on the CI with Python 3.13.0a2 - by :user:`hroncok`.
diff --git a/tests/unit/create/test_creator.py b/tests/unit/create/test_creator.py
index 8b9d688..fc21ad8 100644
--- a/tests/unit/create/test_creator.py
+++ b/tests/unit/create/test_creator.py
@@ -231,7 +231,11 @@ def test_create_no_seed(python, creator, isolated, system, coverage_env, special
         assert os.path.exists(make_file)
 
     git_ignore = (dest / ".gitignore").read_text(encoding="utf-8")
-    assert git_ignore.splitlines() == ["# created by virtualenv automatically", "*"]
+    if creator_key == "venv" and sys.version_info >= (3, 13):
+        comment = "# Created by venv; see https://docs.python.org/3/library/venv.html"
+    else:
+        comment = "# created by virtualenv automatically"
+    assert git_ignore.splitlines() == [comment, "*"]
 
 
 def test_create_vcs_ignore_exists(tmp_path):
diff --git a/tests/unit/create/via_global_ref/builtin/testing/path.py b/tests/unit/create/via_global_ref/builtin/testing/path.py
index b2e1b85..d833de6 100644
--- a/tests/unit/create/via_global_ref/builtin/testing/path.py
+++ b/tests/unit/create/via_global_ref/builtin/testing/path.py
@@ -44,11 +44,15 @@ class PathMockABC(FakeDataABC, Path):
     """Mocks the behavior of `Path`"""
 
     _flavour = getattr(Path(), "_flavour", None)
-
     if hasattr(_flavour, "altsep"):
         # Allows to pass some tests for Windows via PosixPath.
         _flavour.altsep = _flavour.altsep or "\\"
 
+    # Python 3.13 renamed _flavour to pathmod
+    pathmod = getattr(Path(), "pathmod", None)
+    if hasattr(pathmod, "altsep"):
+        pathmod.altsep = pathmod.altsep or "\\"
+
     def exists(self):
         return self.is_file() or self.is_dir()
 
-- 
2.43.0

