Skip to content

Commit 080fb80

Browse files
committed
Set PYTHONUTF8 in stubtest to try and prevent crashes
1 parent 76c8d89 commit 080fb80

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

stubs/networkx/@tests/stubtest_allowlist.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ networkx\.(utils\.)?(backends\.)?_dispatchable\.__call__
3535
networkx.conftest
3636
networkx(\..+?)?\.tests(\..+?)?
3737

38-
# Stubtest crashes due to special unicode character
39-
networkx.readwrite.text.*
40-
4138
# "..._DT is not present at runtime" but we don't set it in stubs, I don't understand this one
4239
networkx(\.algorithms)?(\.tree)?(\.mst)?\.SpanningTreeIterator\.Partition\._DT
4340
networkx(\.algorithms)?(\.tree)?(\.branchings)?\.ArborescenceIterator\.Partition\._DT

stubs/networkx/networkx/readwrite/text.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ class UtfDirectedGlyphs(UtfBaseGlyphs):
4040
last: ClassVar[str]
4141
mid: ClassVar[str]
4242
backedge: ClassVar[str]
43+
vertical_edge: ClassVar[str]
4344

4445
class UtfUndirectedGlyphs(UtfBaseGlyphs):
4546
last: ClassVar[str]
4647
mid: ClassVar[str]
4748
backedge: ClassVar[str]
49+
vertical_edge: ClassVar[str]
4850

4951
def generate_network_text(
5052
graph,

tests/stubtest_third_party.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,13 @@ def run_stubtest(
125125
# It seems that some other environment variables are needed too,
126126
# because the CI fails if we pass only os.environ["DISPLAY"]. I didn't
127127
# "bisect" to see which variables are actually needed.
128-
stubtest_env = os.environ | {"MYPYPATH": mypypath, "MYPY_FORCE_COLOR": "1"}
128+
stubtest_env = os.environ | {
129+
"MYPYPATH": mypypath,
130+
"MYPY_FORCE_COLOR": "1",
131+
# Prevent stubtest crash due to special unicode character
132+
# https://github.com/python/mypy/issues/19071
133+
"PYTHONUTF8": "1",
134+
}
129135

130136
# Perform some black magic in order to run stubtest inside uWSGI
131137
if dist_name == "uWSGI":

0 commit comments

Comments
 (0)