File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import os
4+ import shutil
5+ import sys
36from pathlib import Path
47
58import pytest
1417
1518DIR = Path (__file__ ).parent .absolute ()
1619
20+ has_make = shutil .which ("make" ) is not None or shutil .which ("gmake" ) is not None
21+ has_ninja = shutil .which ("ninja" ) is not None
22+
23+
24+ def prepare_env_or_skip () -> None :
25+ if (
26+ "CMAKE_GENERATOR" not in os .environ
27+ and not sys .platform .startswith ("win32" )
28+ and not has_make
29+ ):
30+ if has_ninja :
31+ os .environ ["CMAKE_GENERATOR" ] = "Ninja"
32+ else :
33+ pytest .skip ("No build system found" )
34+
1735
1836@pytest .mark .configure
1937def test_cattrs_comparison (tmp_path ):
Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import os
4+ import shutil
35import subprocess
46import sys
57from pathlib import Path
1214DIR = Path (__file__ ).parent .absolute ()
1315
1416
17+ has_make = shutil .which ("make" ) is not None or shutil .which ("gmake" ) is not None
18+ has_ninja = shutil .which ("ninja" ) is not None
19+
20+
21+ def prepare_env_or_skip () -> None :
22+ if (
23+ "CMAKE_GENERATOR" not in os .environ
24+ and not sys .platform .startswith ("win32" )
25+ and not has_make
26+ ):
27+ if has_ninja :
28+ os .environ ["CMAKE_GENERATOR" ] = "Ninja"
29+ else :
30+ pytest .skip ("No build system found" )
31+
32+
1533@pytest .fixture (scope = "session" )
1634def config (tmp_path_factory ):
35+ prepare_env_or_skip ()
36+
1737 tmp_path = tmp_path_factory .mktemp ("build" )
1838
1939 build_dir = tmp_path / "build"
@@ -72,6 +92,8 @@ def test_install(config):
7292
7393@pytest .mark .configure
7494def test_variable_defined (tmp_path , capfd ):
95+ prepare_env_or_skip ()
96+
7597 build_dir = tmp_path / "build"
7698
7799 cmake = CMake .default_search (minimum_version = Version ("3.15" ))
You can’t perform that action at this time.
0 commit comments