File: helpers.py

package info (click to toggle)
dh-fortran 0.57
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 816 kB
  • sloc: f90: 5,705; python: 1,485; perl: 610; makefile: 80; sh: 7
file content (32 lines) | stat: -rw-r--r-- 576 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
"""

Helpers for tests
"""


from pathlib import Path
from functools import wraps
import pytest
import os


# @contextmanager
def compiler_present(*args, **kwds):
    """Execute a given block if the named compiler is present, else skip"""
    print(f"compiler_present: args are {args}")


@pytest.fixture
def dry_run():
    os.environ["NO_ACT"] = "1"


def chdir_to_test(testdir: str):
    """Get the current folder of the test"""
    p = Path(__file__).parent.parent / testdir
    pytest.MonkeyPatch.chdir(p)


def make_testdir(dirname: str):
    pass