Skip to content

Commit 113325c

Browse files
authored
fix: Set OBJC_DISABLE_INITIALIZE_FORK_SAFETY for macOS in CLI integration tests (#4644)
1 parent 67428f0 commit 113325c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/cli/test_integration_cli.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import shutil
88
import site
99
import uuid
10+
import os
11+
import platform
1012

1113
pytestmark = pytest.mark.slow
1214

@@ -30,6 +32,11 @@ def invoke_cli(tmp_path: Path) -> InvokeCliType:
3032
).stdout.strip()
3133

3234
def _invoke(sqlmesh_args: t.List[str], **kwargs: t.Any) -> subprocess.CompletedProcess:
35+
# Set up environment to handle macOS fork safety, see https://stackoverflow.com/a/52230415
36+
env = os.environ.copy()
37+
if platform.system() == "Darwin":
38+
env["OBJC_DISABLE_INITIALIZE_FORK_SAFETY"] = "YES"
39+
3340
return subprocess.run(
3441
args=[sqlmesh_bin] + sqlmesh_args,
3542
# set the working directory to the isolated temp dir for this test
@@ -39,6 +46,7 @@ def _invoke(sqlmesh_args: t.List[str], **kwargs: t.Any) -> subprocess.CompletedP
3946
# combine stdout/stderr into a single stream
4047
stdout=subprocess.PIPE,
4148
stderr=subprocess.STDOUT,
49+
env=env,
4250
**kwargs,
4351
)
4452

0 commit comments

Comments
 (0)