summarylogtreecommitdiffstats
path: root/0136-smoketests-update.patch
blob: 8874db793f4f659dd3c8e4fb3a7031e60e104cda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From 05def4bb6e292c3967ef3b219cc720ae28446272 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Sun, 8 Aug 2021 10:19:57 +0200
Subject: [PATCH 136/N] smoketests: update

---
 mingw_smoketests.py | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/mingw_smoketests.py b/mingw_smoketests.py
index 0b99c88..dc26169 100644
--- a/mingw_smoketests.py
+++ b/mingw_smoketests.py
@@ -39,6 +39,38 @@ _UCRT = "clang" in sysconfig.get_platform() or "ucrt" in sysconfig.get_platform(
 
 class Tests(unittest.TestCase):
 
+    def test_userdir_path_sep(self):
+        # Make sure os.path and pathlib use the same path separators
+        from unittest import mock
+        from os.path import expanduser
+        from pathlib import Path
+
+        profiles = ["C:\\foo", "C:/foo"]
+        for profile in profiles:
+            with mock.patch.dict(os.environ, {"USERPROFILE": profile}):
+                self.assertEqual(expanduser("~"), os.path.normpath(expanduser("~")))
+                self.assertEqual(str(Path("~").expanduser()), expanduser("~"))
+                self.assertEqual(str(Path.home()), expanduser("~"))
+
+    def test_sysconfig_schemes(self):
+        # https://github.com/msys2/MINGW-packages/issues/9319
+        import sysconfig
+        from distutils.dist import Distribution
+        from distutils.command.install import install
+
+        names = ['scripts', 'purelib', 'platlib', 'data', 'include']
+        for scheme in ["nt", "nt_user"]:
+            for name in names:
+                c = install(Distribution({"name": "foobar"}))
+                c.user = (scheme == "nt_user")
+                c.finalize_options()
+                if name == "include":
+                    dist_path = os.path.dirname(getattr(c, "install_" + "headers"))
+                else:
+                    dist_path = getattr(c, "install_" + name)
+                sys_path = sysconfig.get_path(name, scheme)
+                self.assertEqual(dist_path, sys_path, (scheme, name))
+
     def test_ctypes_find_library(self):
         from ctypes.util import find_library
         from ctypes import cdll
-- 
2.32.0