File: lib.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 (56 lines) | stat: -rw-r--r-- 1,446 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
#!/usr/bin/python3
"""
Test Driver for dh_fortran_lib

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

from click.testing import CliRunner
from dhfortran.lib import dh_fortran_lib, get_soname
from dhfortran.compilers import libdir
import dhfortran.debhelper as dh
import dhfortran.tests.helpers as helpers
import pytest
import os


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

def test_get_soname():
    """ soname helper """
    (major, soname,ext ) = get_soname(f"{libdir}/libm.so.6")
    assert soname == "libm.so.6"
    assert major == "6"
    assert ext == ".6"
    (major, soname, ext) = get_soname(f"{libdir}/libgccpp.so.1.5.0")
    assert major == "1"
    assert soname == "libgccpp.so.1"
    assert ext == ".1.5.0"
    

def test_dh_fortran_lib():
    """Install libs in appropriate directory"""
    # helpers.chdir_to_test('tests/pkg')
    runner = CliRunner()
    result = runner.invoke(dh_fortran_lib, [])
    assert result.exit_code == 0
    # assert result.output == 'Hello Peter!\n'


def test_dh_fortran_lib_files_nopkg():
    """Install libs in appropriate directory"""
    # helpers.chdir_to_test('tests/pkg')
    runner = CliRunner()
    result = runner.invoke(dh_fortran_lib, ["debian/tmp/foo"])
    assert result.exit_code == 0
    # assert result.output == 'Hello Peter!\n'



if __name__ == "__main__":
    import pytest

    pytest.main()