From: Stefano Rivera <stefanor@debian.org>
Date: Sat, 19 Feb 2022 15:01:28 -0400
Subject: Massage test output on 32-bit systems to match 64-bit systems

Fixes test_sphinx_directives[35-highlight (sphinx.directives.code.Highlight):]
which was failing on 32-bit platforms due to linenothreshold defaulting
to sys.maxsize.

Fixes: #522
Bug-Debian: https://bugs.debian.org/1005691
Bug-Upstream: https://github.com/executablebooks/MyST-Parser/issues/522
Forwarded: https://github.com/executablebooks/MyST-Parser/pull/523
---
 tests/test_renderers/test_fixtures.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tests/test_renderers/test_fixtures.py b/tests/test_renderers/test_fixtures.py
index 7771a55..bb54573 100644
--- a/tests/test_renderers/test_fixtures.py
+++ b/tests/test_renderers/test_fixtures.py
@@ -1,4 +1,5 @@
 import re
+import sys
 from pathlib import Path
 
 import pytest
@@ -112,15 +113,20 @@ def test_sphinx_directives(line, title, input, expected):
         pytest.skip(title)
     elif title.startswith("SPHINX4") and sphinx.version_info[0] < 4:
         pytest.skip(title)
-    document = to_docutils(input, in_sphinx_env=True)
+    document = to_docutils(input, in_sphinx_env=True).pformat()
+
+    # see https://github.com/executablebooks/MyST-Parser/issues/522
+    if sys.maxsize == 2147483647:
+        document = document.replace('"2147483647"', '"9223372036854775807"')
+
     _actual, _expected = [
         "\n".join([ll.rstrip() for ll in text.splitlines()])
-        for text in (document.pformat(), expected)
+        for text in (document, expected)
     ]
     try:
         assert _actual == _expected
     except AssertionError:
-        print(document.pformat())
+        print(document)
         raise
 
 
