Skip to content

Commit

Permalink
Patch test_sysconfig to work with Meta's build
Browse files Browse the repository at this point in the history
Summary:
changes needed due to:

1. we customize multiarch and extension suffix in the internal build
2. we hack around sysconfig `srcdir` to work with how buck does things
3. the tests run in a "install" target, with no access to intermediate build outputs (e.g. Makefile etc), so it kinda looks like an OOT, but not really

Reviewed By: aleivag

Differential Revision: D52497968

fbshipit-source-id: 4fb09d771d00bce09014b3d1c5aee43bf16655ad
  • Loading branch information
itamaro authored and facebook-github-bot committed Jan 5, 2024
1 parent 4931f44 commit 3ffd87d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Lib/test/test_sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,9 @@ def test_srcdir(self):
srcdir = sysconfig.get_config_var('srcdir')

self.assertTrue(os.path.isabs(srcdir), srcdir)
self.assertTrue(os.path.isdir(srcdir), srcdir)
# START META PATCH (not applicable to our internal build)
# self.assertTrue(os.path.isdir(srcdir), srcdir)
# END META PATCH

if sysconfig._PYTHON_BUILD:
# The python executable has not been installed so srcdir
Expand Down Expand Up @@ -493,7 +495,9 @@ def test_triplet_in_ext_suffix(self):
if ctypes.sizeof(ctypes.c_char_p()) == 4:
expected_suffixes = 'i386-linux-gnu.so', 'x86_64-linux-gnux32.so', 'i386-linux-musl.so'
else: # 8 byte pointer size
expected_suffixes = 'x86_64-linux-gnu.so', 'x86_64-linux-musl.so'
# START META PATCH (expect our multiarch extension suffix)
expected_suffixes = 'x86_64-linux-gnu.so', 'x86_64-linux-musl.so', 'fb-010-x86_64.so'
# END META PATCH
self.assertTrue(suffix.endswith(expected_suffixes),
f'unexpected suffix {suffix!r}')

Expand All @@ -507,6 +511,9 @@ class MakefileTests(unittest.TestCase):
@unittest.skipIf(sys.platform.startswith('win'),
'Test is not Windows compatible')
@unittest.skipIf(is_wasi, "Incompatible with WASI mapdir and OOT builds")
# START META PATCH (skip test in the internal build)
@unittest.skipIf("+meta" in sys.version, "Incompatible with how we run tests internally")
# END META PATCH
def test_get_makefile_filename(self):
makefile = sysconfig.get_makefile_filename()
self.assertTrue(os.path.isfile(makefile), makefile)
Expand Down

0 comments on commit 3ffd87d

Please sign in to comment.