aboutsummaryrefslogtreecommitdiff
path: root/unittests/__init__.py
blob: fb8fb8e851a576103d5f14757aace6badb792f04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os

import mesonbuild.compilers
from mesonbuild.mesonlib import setup_vsenv

def unset_envs():
    # For unit tests we must fully control all command lines
    # so that there are no unexpected changes coming from the
    # environment, for example when doing a package build.
    varnames = ['CPPFLAGS', 'LDFLAGS'] + list(mesonbuild.compilers.compilers.CFLAGS_MAPPING.values())
    for v in varnames:
        if v in os.environ:
            del os.environ[v]

def set_envs():
    os.environ.setdefault('MESON_UNIT_TEST_BACKEND', 'ninja')

setup_vsenv()
unset_envs()
set_envs()