Source code for spack.test.link_paths

# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import re
import sys

import pytest

import spack.paths
from spack.compiler import _parse_non_system_link_dirs

is_windows = sys.platform == 'win32'
if is_windows:
    drive_m ='[A-Za-z]:', spack.paths.test_path)
    drive = if drive_m else None
#: directory with sample compiler data
datadir = os.path.join(spack.paths.test_path, 'data',

[docs]@pytest.fixture(autouse=True) def allow_nonexistent_paths(monkeypatch): # Allow nonexistent paths to be detected as part of the output # for testing purposes. monkeypatch.setattr(os.path, 'isdir', lambda x: True)
[docs]def test_obscure_parsing_rules(): if is_windows: check_link_paths('obscure-parsing-rules.txt', [ drive + r'\first\path', drive + r'\third\path']) else: check_link_paths('obscure-parsing-rules.txt', [ '/first/path', '/second/path', '/third/path'])