File: module.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 (89 lines) | stat: -rw-r--r-- 2,394 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/python3
"""
Module file handling for Fortran: tests

Copyright (C) 2025 Alastair McKinstry <mckinstry@debian.org>
Released under the GPL-3 Gnu Public License.
"""

import dhfortran.module as mod
from click.testing import CliRunner
from pathlib import Path
import pytest

def test_dh_fortran_mod_cmdline1():
    runner = CliRunner()
    result = runner.invoke(mod.dh_fortran_mod, ['debian/tmp/lib/points.mod'])
    assert result.exit_code == 0

def test_dh_fortran_mod():
    """ Install mod files. Normal case"""
    runner = CliRunner()
    result = runner.invoke(mod.dh_fortran_mod, [])
    assert result.exit_code == 0

    

@pytest.mark.skip
def test_which_compiler_gf14():
    if not Path("/usr/bin/gfortran-14").exists():
        return
    assert "gfortran-mod-15" == mod.which_compiler("modfiles/gfortran-14/points.mod")


@pytest.mark.skip
def test_which_compiler_gf15():
    if not Path("/usr/bin/gfortran-15").exists():
        return
    assert "gfortran-mod-16" == mod.which_compiler("modfiles/gfortran-15/points.mod")


@pytest.mark.skip
def test_which_compiler_fn18():
    if not Path("/usr/bin/flang-new-18").exists():
        return
    assert "flang-mod-1" == mod.which_compiler("modfiles/flang-new-18/points.mod")


@pytest.mark.skip
def test_which_compiler_fe18():
    if not Path("/usr/bin/flang-to-external-fc").exists():
        return
    # actual mod depends on gfortran external
    assert mod.which_compiler("modfiles/flang-ext-18/points.mod").startswith(
        "flangext-mod-"
    )


@pytest.mark.skip
def test_which_compiler_fn19():
    if not Path("/usr/bin/flang-new-19").exists():
        return
    assert "flang-mod-1" == mod.which_compiler("modfiles/flang-new-19/points.mod")


@pytest.mark.skip
def test_which_compiler_fn20():
    if not Path("/usr/bin/flang-new-20").exists():
        return
    assert "flang-mod-1" == mod.which_compiler("modfiles/flang-new-20/points.mod")


@pytest.mark.skip
def test_which_compiler_fn21():
    if not Path("/usr/bin/flang-new-21").exists():
        return
    assert "flang-mod-1" == mod.which_compiler("modfiles/flang-new-21/points.mod")


@pytest.mark.skip
def test_which_compiler_lfortran():
    if not Path("/usr/bin/lfortran").exists():
        return
    assert "lfortran-mod-0" == mod.which_compiler("modfiles/lfortran/points.mod")


if __name__ == "__main__":
    import pytest

    pytest.main()