From d9fb5fbc3f0e9975a417822fa1178d0862bb0530 Mon Sep 17 00:00:00 2001 From: Mark Hammond Date: Sat, 27 Mar 2021 13:49:14 +1100 Subject: [PATCH] Add note and test for GetEnvironmentStrings() fix in #1661 --- CHANGES.txt | 3 +++ win32/test/test_win32profile.py | 15 +++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 win32/test/test_win32profile.py diff --git a/CHANGES.txt b/CHANGES.txt index 8651319d3..658445ff2 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,6 +8,9 @@ Note that build 228 was the last version supporting Python 2. Since build 300: ---------------- +* Fix a bug in `win32profile.GetEnvironmentStrings()` relating to environment + variables with an equals sign (@maxim-krikun in #1661) + * Added win32com.shell.SHGetKnownFolderPath() and related constants. * Shifted work in win32.lib.pywin32_bootstrap to Python's import system from diff --git a/win32/test/test_win32profile.py b/win32/test/test_win32profile.py new file mode 100644 index 000000000..b2fbaee09 --- /dev/null +++ b/win32/test/test_win32profile.py @@ -0,0 +1,15 @@ +"""Test win32profile""" +import os +import unittest +import win32profile + +class Tester(unittest.TestCase): + def test_environment(self): + os.environ["FOO"] = "bar=baz" + env = win32profile.GetEnvironmentStrings() + assert "FOO" in env + assert env["FOO"] == "bar=baz" + assert os.environ["FOO"] == "bar=baz" + +if __name__ == '__main__': + unittest.main()