diff --git a/eden/integration/chown_test.py b/eden/integration/chown_test.py index 827a4c5317..968a4a6af6 100644 --- a/eden/integration/chown_test.py +++ b/eden/integration/chown_test.py @@ -4,9 +4,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2. -import grp import os -import pwd from .lib import repobase, testcase @@ -33,6 +31,9 @@ class ChownTest(testcase.EdenRepoTest): return self.create_hg_repo("main") def setup_eden_test(self) -> None: + import grp + import pwd + super().setup_eden_test() self.nobody_uid = pwd.getpwnam("nobody").pw_uid self.nobody_gid = grp.getgrnam("nobody").gr_gid diff --git a/eden/integration/linux_cgroup_test.py b/eden/integration/linux_cgroup_test.py index 3e956af273..28755e5bda 100644 --- a/eden/integration/linux_cgroup_test.py +++ b/eden/integration/linux_cgroup_test.py @@ -7,11 +7,18 @@ import os import os.path import pathlib +import platform import unittest -from .lib.linux import LinuxCgroup, is_cgroup_v2_mounted from .lib.testcase import IntegrationTestCase +if platform.system() != "Windows": + from .lib.linux import LinuxCgroup, is_cgroup_v2_mounted +else: + + def is_cgroup_v2_mounted(): + return False + class LinuxCgroupTest(IntegrationTestCase): def test_parse_proc_file(self) -> None: diff --git a/eden/integration/mmap_test.py b/eden/integration/mmap_test.py index f88842a05a..afd23072bc 100644 --- a/eden/integration/mmap_test.py +++ b/eden/integration/mmap_test.py @@ -7,6 +7,7 @@ import ctypes import mmap import os +import platform import subprocess from ctypes import c_int, c_size_t, c_ssize_t, c_void_p @@ -18,14 +19,16 @@ from .lib import testcase # # We have to ignore type errors on the next line until we update to a version # of typeshed that includes https://github.com/python/typeshed/pull/3945 -libc = ctypes.CDLL(None) -c_off_t = c_ssize_t +libc = None +if platform.system() != "Windows": + libc = ctypes.CDLL(None) + c_off_t = c_ssize_t -libc.mmap.argtypes = [c_void_p, c_size_t, c_int, c_int, c_off_t] -libc.mmap.restype = ctypes.POINTER(ctypes.c_byte) + libc.mmap.argtypes = [c_void_p, c_size_t, c_int, c_int, c_off_t] + libc.mmap.restype = ctypes.POINTER(ctypes.c_byte) -libc.munmap.restype = c_void_p -libc.munmap.argtypes = [c_void_p, c_size_t] + libc.munmap.restype = c_void_p + libc.munmap.argtypes = [c_void_p, c_size_t] @testcase.eden_repo_test diff --git a/eden/integration/takeover_test.py b/eden/integration/takeover_test.py index 48358492e6..92895a7561 100644 --- a/eden/integration/takeover_test.py +++ b/eden/integration/takeover_test.py @@ -5,7 +5,6 @@ # GNU General Public License version 2. import os -import resource import signal import sys import threading @@ -34,6 +33,8 @@ class TakeoverTest(testcase.EdenRepoTest): enable_fault_injection: bool = True def populate_repo(self) -> None: + import resource + self.pagesize = resource.getpagesize() self.page1 = "1" * self.pagesize self.page2 = "2" * self.pagesize