File: test_pkgconfig.py

package info (click to toggle)
rpmlint 2.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 8,308 kB
  • sloc: python: 20,622; ansic: 2,511; xml: 1,272; makefile: 17; sh: 4
file content (34 lines) | stat: -rw-r--r-- 1,251 bytes parent folder | download | duplicates (2)
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
from mockdata.mock_pkgconfig import LibReiserFSCoreDevelPackage, PCPackage
import pytest
from rpmlint.checks.PkgConfigCheck import PkgConfigCheck
from rpmlint.filter import Filter

from Testing import CONFIG


@pytest.fixture(scope='function', autouse=True)
def pkgconfigcheck():
    CONFIG.info = True
    output = Filter(CONFIG)
    test = PkgConfigCheck(CONFIG, output)
    return output, test


@pytest.mark.parametrize('package', [PCPackage])
def test_pkg_config(package, pkgconfigcheck):
    output, test = pkgconfigcheck
    test.check(package)
    out = output.print_results(output.results)
    assert 'E: invalid-pkgconfig-file /tmp/pkgconfig/xcb.pc' in out
    assert 'E: pkgconfig-invalid-libs-dir /tmp/pkgconfig/xcb.pc Libs: -L/usr/lib' in out
    assert 'E: double-slash-in-pkgconfig-path /tmp/pkgconfig/xcb.pc includedir=/usr/include//xyz' in out


@pytest.mark.parametrize('package', [LibReiserFSCoreDevelPackage])
def test_pkg_config_correct(package, pkgconfigcheck):
    output, test = pkgconfigcheck
    test.check(package)
    out = output.print_results(output.results)
    assert 'E: invalid-pkgconfig-file' not in out
    assert 'E: pkgconfig-invalid-libs-dir' not in out
    assert 'E: double-slash-in-pkgconfig-path' not in out